Download the PHP package rusdyahmad/php-easyparcel without Composer
On this page you can find all versions of the php package rusdyahmad/php-easyparcel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rusdyahmad/php-easyparcel
More information about rusdyahmad/php-easyparcel
Files in rusdyahmad/php-easyparcel
Package php-easyparcel
Short Description A PHP wrapper for the EasyParcel API
License MIT
Informations about the package php-easyparcel
PHP EasyParcel
A PHP wrapper for the EasyParcel API.
Installation
Requirements
- PHP 7.2 or higher
- Guzzle HTTP Client
- JSON extension
Usage
Initialization
There are multiple ways to initialize the EasyParcel client:
Method 1: Direct API Key
Method 2: Using Environment Variables (.env)
Create a .env
file in your project root (copy from .env.example
):
Then initialize without parameters:
Note: EasyParcel uses the same API key for both production and sandbox environments. The environment is determined by the base URL, not the API key.
Check Credit Balance
Get Shipping Rates
Using the direct method:
Using the ShipmentBuilder:
Submit Order
Pay for Order
Using the Response Class
Available Methods
EasyParcel Class
checkBalance()
: Check credit balancegetRates(array $shipment)
: Get shipping rates for a single shipmentgetBulkRates(array $shipments)
: Get shipping rates for multiple shipmentssubmitOrder(array $order)
: Submit a single ordersubmitBulkOrders(array $orders)
: Submit multiple orderspayOrder(string $orderNo)
: Pay for a single orderpayBulkOrders(array $orderNos)
: Pay for multiple ordersgetParcelCategoryList()
: Get parcel category listgetCourierList()
: Get courier listgetCourierDropoff(string $courierCode, string $postcode)
: Get courier dropoff pointsuseSandbox()
: Switch to sandbox environmentuseProduction()
: Switch to production environmentgetBaseUrl()
: Get the current base URL
ShipmentBuilder Class
from(string $name, string $contact, string $address1, string $city, string $postcode, string $state, string $country)
: Set pickup detailsfromCompany(string $company)
: Set sender company namefromAddress2(string $address2)
: Set sender address line 2fromMobile(string $mobile)
: Set sender mobile numberto(string $name, string $contact, string $address1, string $city, string $postcode, string $state, string $country)
: Set receiver detailstoCompany(string $company)
: Set receiver company nametoAddress2(string $address2)
: Set receiver address line 2toMobile(string $mobile)
: Set receiver mobile numbertoEmail(string $email)
: Set receiver emailwithDimensions(float $weight, float $width, float $length, float $height)
: Set parcel dimensionswithContent(string $content, float $value)
: Set parcel contentwithServiceId(string $serviceId)
: Set service IDwithCollectionDate(string $date)
: Set collection datewithInsurance(bool $enabled)
: Enable insurance addonwithSmsNotification(bool $enabled)
: Enable SMS notificationwithWhatsAppTracking(bool $enabled)
: Enable WhatsApp trackingwithParcelCategory(string $categoryId)
: Set parcel category IDwithPickupPoint(string $point)
: Set pickup pointwithDropoffPoint(string $point)
: Set dropoff pointbuild()
: Get the shipment data
Response Class
isSuccessful()
: Check if the response is successfulgetErrorCode()
: Get error codegetErrorMessage()
: Get error messagegetResult()
: Get result datagetRates()
: Get rates from resultgetOrderDetails()
: Get order details from resultgetOrderNumber()
: Get order number from resultgetParcelStatus()
: Get parcel status from resultgetShipmentCost()
: Get shipment cost from resultgetTrackingNumber()
: Get tracking number from resultgetRawData()
: Get raw response data
Switching Between Production and Sandbox Environments
EasyParcel provides both production and sandbox environments for testing. There are two ways to switch between these environments:
Method 1: Using Constructor Options
Method 2: Using Environment Setter Methods
Remember to use the same API key for both environments.
License
MIT
All versions of php-easyparcel with dependencies
guzzlehttp/guzzle Version ^7.0
ext-json Version *
vlucas/phpdotenv Version ^5.6