naqel / sdk
A PHP wrapper for Naqel's API
Requires
- php: >=7.4
- ext-json: *
- ext-soap: *
- illuminate/collections: ^8.24
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.18
- phpunit/phpunit: ^9.5
README
Documentation
The documentation for the Naqel API can be found here.
Supported PHP Versions
This library supports the following PHP implementations:
- PHP 7.4
- PHP 8.0
Installation
You can install naqel-php via a composer or by downloading the source.
Via Composer:
naqel-php is available on Packagist as the
naqel/sdk
package:
composer require naqel/sdk
Quickstart:
Set the configurations with your credential and information:
$naqel = new \Naqel\Naqel([ 'use_sandbox' => true, 'client_id' => '[YOUR_CLIENT_ID]', 'password' => '[YOUR_CLIENT_PASSWORD]', 'version' => '9.0', ]); // Set your address $clientAddress = (new \Naqel\Models\ClientAddress()) ->setPhoneNumber('0555555555') ->setFirstAddress('King Abdulaziz Street') ->setCountryCode('KSA') ->setCityCode('RUH'); // Set your contact $clientContact = (new \Naqel\Models\ClientContact()) ->setName('Mohammad') ->setPhoneNumber('05xxxxxxxx'); // Attach both address and contact to Naqel instance $naqel->setClientAddress($clientAddress); $naqel->setClientContact($clientContact);
Set Consignee Info:
$consigneeInfo = (new \Naqel\Models\ConsigneeInfo()) ->setConsigneeName('Abdullah') ->setPhoneNumber('05xxxxxxxx') ->setAddress('King Salman Street') ->setCountryCode('KSA') ->setCityCode('RUH');
Set Manifest Shipment:
$manifestShipment = (new \Naqel\Models\ManifestShipment()) ->setConsigneeInfo($consigneeInfo) ->setBillingType(\Naqel\Constants\BillingType::ON_ACCOUNT) ->setLoadTypeID(\Naqel\Constants\LoadType::NON_DOCUMENT) ->setPiecesCount(1) ->setWeight(1.0);
Create a New Waybill w/ Manifest:
$waybill = \Naqel\Waybill::create($manifestShipment);
Or you can get a waybill instance by its number
$waybill = \Naqel\Waybill::create($waybill->number());
Get the waybill number:
$waybillNumber = $waybill->number();
Get the waybill sticker as a PDF content:
$sticker = $waybill->printSticker( \Naqel\Constants\StickerSize::FourMFourInches );
Versioning
naqel-php
uses a SemVer for versioning. For the versions available, see the tags on this repository.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
License
This project is licensed under the MIT License - see the LICENSE file for details