oceanapplications / postmen
API Wrapper for postmen.com
Installs: 360
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/oceanapplications/postmen
Requires (Dev)
- phpunit/phpunit: 5.5.*
- vlucas/phpdotenv: 2.3
This package is auto-updated.
Last update: 2025-09-29 02:41:59 UTC
README
API wrapper for https://www.postmen.com/
###Install with composer
composer require oceanapplications/postmen
###Create label
//create item $item = new Item(); $item->description('description')->quantity(1)->price(new Money(100, 'INR'))->weight(new Weight(1,'lb')); //create parcel $parcel = new Parcel(); $parcel->box_type('custom')->dimension(new Dimension(4,4,4,"cm"))->items($item)->description('descr')->weight(new Weight(2, 'lb')); //create from address $fromAddress = new Address(); $fromAddress->city('New Delhi')->company_name('company India')->country('IND')->contact_name('Name')->street1('street1') ->postal_code('110045')->state('Delhi')->phone('9654444444'); //create send address $toAddress = new Address(); $toAddress->city('New Delhi')->company_name('company India')->country('IND')->contact_name('Name')->street1('street1') ->postal_code('110045')->state('Delhi')->phone('9654444444'); //create shipment and assign addresses and parcel $shipment = new Shipment(); $shipment->ship_from($fromAddress); $shipment->ship_to($toAddress); $shipment->parcels(array($parcel)); //create label and assign shipment $label = new Label(); $label->service_type('bluedart_surface')->shipper_account('shipper id from postmen') ->shipment($shipment)->invoice(new Invoice())->COD(new Money(100, 'INR')); //finally create client and send request $client = new Client('postmen api_key'); $response = $client->createLabel($label);