承接 crakter/bringapi 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

crakter/bringapi

最新稳定版本:3.0.3

Composer 安装命令:

composer require crakter/bringapi

包简介

BringApi is a fully functional library to help contact Bring API

README 文档

README

Build Status

Bring API PHP is a library to contact Bring API for prices, booking, reports and so on. I did not find anything that i could use for my project with PHP and Bring API. So i needed a good library that was reusable. This is used in production of a large Norwegian wholesaler.

Install

Composer (recommended)

Can be installed directly with Composer.

Run the following command in correct directory.

$ composer require crakter/bringapi

Requirements

  • PHP version 7.2.0 or higher
  • PHP extension php_simplexml enabled (enabled by default in 5.1.2 and above)

Supported Apis

  • Shipping Guide API
    • Get estimated prices
    • Get Estimated delivery time
    • Get Estimated shipment prices, delivery time and more
  • Booking API
    • List customer names
    • Book Shipments
    • Order pickups
  • Tracking API
    • Track shipments (also logged in)
    • Download Signature
  • Reports API
    • List available customers
    • List available reports for a customer
    • Generate a report
    • Check the status of a report
    • List invoice numbers
  • Postal Code API
    • Lookup postal code

Basic usage

Tracking as logged in

If you remove the authorizationModule you can track like normal user.

use Crakter\BringApi\Entity\TrackingEntity;
use Crakter\BringApi\Clients\Authorization;
use Crakter\BringApi\Clients\Tracking\TrackingEndpoint;

$trackingEntity = (new TrackingEntity)->set(['q' => 'TESTPACKAGE-AT-PICKUPPOINT']); // Can be used like this
//$trackingEntity = (new TrackingEntity)->setQ('TESTPACKAGE-AT-PICKUPPOINT'); // Can also be used like this
/* And like this
$trackingEntity = (new TrackingEntity);
$trackingEntity->q = 'TESTPACKAGE-AT-PICKUPPOINT';
*/
$authorizationModule = (new Authorization)
    ->setApiKey('1234abc-abcd-1234-5678-abcd1234abcd')
    ->setClientId('example@example.no')
    ->setClientUrl('http://example.com');

$tracking = (new TrackingEndpoint)
    ->setAuthorizationModule($authorizationModule)
    ->setApiEntity($trackingEntity)
    ->send();
print_r($tracking->toArray());

Advanced Usage

Look in the examples folder or you can generate the documents using Sami (composer dev-dependency).

For people running Linux

vendor/bin/sami.php -n render SamiConfig.php

For people running Windows

"vendor/bin/sami.php.bat" -n render SamiConfig.php

You will now find the documents in the docs/build folder.

Running examples

For the tests to be able to run the Bring UID, Bring API Key and Customer number has to be set in the environment

For people running Linux

export BRING_UID="john.doe@example.com" && export BRING_API_KEY="1234abc-abcd-1234-5678-abcd1234abcd" && export BRING_CUSTOMER_NUMBER="	PARCELS_NORWAY-10001123123"

For people running Windows

setx BRING_UID john.doe@example.com
setx BRING_API_KEY 1234abc-abcd-1234-5678-abcd1234abcd
setx BRING_CUSTOMER_NUMBER PARCELS_NORWAY-10001123123

Go into a new command prompt and run the examples. Some examples can be passed with arguments like postalcodes.

cd examples/
php BookAndPickupShipment.php
php PostalCode.php <numberOfPostalCode>
php ShippingGuideAll.php <fromPostalCode> <toPostalCode>
php Tracking.php <query>
php Reports.php <reportId>

Contribute

Contributions are very welcomed.

Please follow PSR-2 coding standard. You can run php-cs-fixer to fix the problems in the code.

License

MIT

统计信息

  • 总下载量: 6.03k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-06-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固