PaperFly Courier – PHP/Laravel Package
Paperfly is a Bangladeshi courier/logistic company for reliable Delivery Business. This is a Laravel/PHP package for Paperfly. This package can be used in laravel or without laravel/php projects. We created this package while working for a project and thought to made it release for all so that it helps. In this blog, I explain how you can easily use Pathao courier API by using laravel/PHP.
Paperfly – Laravel/PHP Package source code available via github and released via Packagist as regular regular php composer package.
Requirements
- PHP >=7.4
- Laravel >= 6
Installation
<code class="language-php"> composer require codeboxr/paperfly-courier </code>
After publish config file setup your credential. you can see this in your config directory paperfly.php file
<code class="language-php"> return [ "sandbox" => env("PAPERFLY_SANDBOX", false), // for sandbox mode use true "username" => env("PAPERFLY_USERNAME", ""), "password" => env("PAPERFLY_PASSWORD", ""), "key" => env("PAPERFLY_KEY", "") ]; </code>
Set .env configuration
<code class="language-php"> PAPERFLY_SANDBOX=true // for production mode use false PAPERFLY_USERNAME="" PAPERFLY_PASSWORD="" PAPERFLY_KEY="" </code>
Usage
1. Parcel Create
<code class="language-php"> use Codeboxr\PaperflyCourier\Facade\PaperflyCourier; return PaperflyCourier::order()->create([ "merOrderRef" => "", // merchant invoice id "pickMerchantName" => "" // Pickup store name, "pickMerchantAddress" => "" // Pickup address, "pickMerchantThana" => "" // Pickup thana name, "pickMerchantDistrict" => "" // Pickup district name, "pickupMerchantPhone" => "" // Pickup contact person name, "productSizeWeight" => "standard", "productBrief" => "" // Parcel product details, "packagePrice" => "" //parcel price, "deliveryOption" => "regular", "custname" => "" // customer name, "custaddress" => "" // customer address, "customerThana" => "" // customer thana name, "customerDistrict" => "" // customer district name, "custPhone" => "" // customer phone number, "max_weight" => "" // parcel weight in kg ]); </code>
2. Parcel Tracking
<code class="language-php"> use Codeboxr\PaperflyCourier\Facade\PaperflyCourier; return PaperflyCourier::order()->tracking($trackingNumber) // Tracking Number </code>
3. Parcel Details
<code class="language-php"> use Codeboxr\PaperflyCourier\Facade\PaperflyCourier; return PaperflyCourier::order()->invoice($referenceNumber) // reference number </code>
4. Cancel Parcel
<code class="language-php"> use Codeboxr\PaperflyCourier\Facade\PaperflyCourier; return PaperflyCourier::order()->cancel($referenceNumber) // reference number </code>
Contributing
Contributions to the Paperfly courier package are welcome. Please note the following guidelines before submitting your pull request.
- Follow PSR-4 coding standards.
- Read Paperfly API documentations first
License
Paperfly package is licensed under the MIT License.
Copyright 2022 Codeboxr