This is a package intended to create JSON export for Postman Collection.
- This project is still work in progress
Postman has a slightly different convention when it comes to the front end, as when compared to the JSON import/export schema. Here is a list of objects used and it's usage with reference to Postman.
Name | Description |
---|---|
Collection | Top level container for all requests |
Item | Alias for Folder. Used for directory like structure |
Event | Contains pre-request and post-request (tests) scripts |
Url | All url related data, including path variables |
Header | Custom headers key value pair |
Body | Request data, in case of POST, PUT and PATCH requests |
Variable | Collection variables data |
A Postman collection can contain many Item (Folder) or Request objects
use WebScientist\Postman\Services\PostmanService as Postman;
$postman = new Postman();
$collection = $postman->collection('My Collection Name');
$folder = $collection->folder($folderName);
$request = $postman->request($requestName)
->url($url)
->header($key, $value)
->body($mode, $data)
->description($description);
Header can be applied to either Collection, Item or Request object by using the header()
method.
$collection->header($key, $value);
$item->header($key, $value);
$request->header($key, $value);