naqel/sdk
Composer 安装命令:
composer require naqel/sdk
包简介
A PHP wrapper for Naqel's API
关键字:
README 文档
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
统计信息
- 总下载量: 209
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-22