sergeevpasha/laravel-dellin
Composer 安装命令:
composer require sergeevpasha/laravel-dellin
包简介
Dellin API wrapper for Laravel
README 文档
README
Laravel Dellin API Wrapper
Allows you to:
- Find a City by query string
- Find a Street by City ID and query string
- Find Terminals in the City by City ID
- Calculate a delivery
Pre-requirements
You need to get Dellin API key, login and password. Key can be obtained at https://dev.dellin.ru/registration
Installation
composer require sergeevpasha/laravel-dellin
Configuration
This package has a few configuration values:
'key' => env('DELLIN_KEY', null),
'login' => env('DELLIN_LOGIN', null),
'password' => env('DELLIN_PASSWORD', null),
'prefix' => 'dellin',
'middleware' => ['web']
If you only need to use DellinClient, you may completely skip this configuration. Otherwise, you can use default options and specify some data in .env file:
- DELLIN_KEY
- DELLIN_LOGIN
- DELLIN_PASSWORD
To make full use of predefined routes, you will need to publish config:
php artisan vendor:publish --provider="SergeevPasha\Dellin\Providers\DellinServiceProvider" --tag="config"
Now you can change routes prefix and middleware to whatever you need
Use Case #1
After installing you may just import the client
use SergeevPasha\Dellin\Libraries\DellinClient;
Firstly let's initialize our client
$client = new DellinClient('key');
/*
You may also authorize your user and get a session ID.
You may use it in getPrice() method to adjust prices (Authorized users have lower prices)
*/
$session = client->authorize('login', 'password);
Now we can use these methods:
$client->findCity(string $query) $client->findCityStreet(int $city, string $query) $client->getCityTerminals(int $city, bool $arrival = true) /* This one requires a Delivery Object, see next to see how to build it */ $client->getPrice(Delivery $delivery)
Delivery Object
To build a Delivery object you will need to pass an array to fromArray() method just like that:
Delivery::fromArray([
'session_id' => '12345', // User Session ID, Not required
'delivery_type' => '1', // Delivery Type, see available Delivery Types below
'arrival_shipping_type' => '1', // Shipping Type, see available Shipping Types below
/* Only one of the following is required */
'arrival_terminal_id' => '123'
'arrival_address_id' => '123'
'arrival_street_code' => '123'
'arrival_city_code' => '123'
/* --- */
/* Next lines are NOT required */
'arrival_worktime_start' => '12:30', // Time format HH:MM
'arrival_worktime_end' => '13:00',
'arrival_break_start' => '15:30',
'arrival_break_end' => '16:00',
'arrival_exact_time' => '1', // Boolean flag to show that there should be an exact time pickup a cargo
'arrival_freight_lift' => '1', // Boolean flag, specify if there is a lift on arrival location
'arrival_to_floor' => '10', // Floor level to deliver
'arrival_carry' => '100', // Meters to deliver
'arrival_requirements' => [
'0x92fce2284f000b0241dad7c2e88b1655',
], // You can get these codes from getSpecialRequirements() method
'derival_produce_date' => '2020-10-10' // Date, when this order should be done (YYYY-MM-DD)
/* Below are the same specs, but for the derival */
'derival_shipping_type' => '1', // Shipping Type, see available Shipping Types below
'derival_terminal_id' => '123'
'derival_address_id' => '123'
'derival_street_code' => '123'
'derival_city_code' => '123'
'derival_worktime_start' => '12:30', // Time format HH:MM
'derival_worktime_end' => '13:00',
'derival_break_start' => '15:30',
'derival_break_end' => '16:00',
'derival_exact_time' => '1', // Boolean flag to show that there should be an exact time pickup a cargo
'derival_freight_lift' => '1', // Boolean flag, specify if there is a lift on arrival location
'derival_to_floor' => '10', // Floor level to deliver
'derival_carry' => '100', // Meters to deliver
'derival_requirements' => [
'0x92fce2284f000b0241dad7c2e88b1655',
]
'packages' => [
'0x838fc70baeb49b564426b45b1d216c15'
], // You can get these codes from getAvailablePackages() method
'ac_docs_send' => '1', // Boolean flag to send accompanying documents
'ac_docs_return' => '1', // Boolean flag to return accompanying documents
'requester_role' => '1', // Requester Role, see available Requester Roles below
'requester_uid' => 'xxxx-xxxx' // Who is ordering delivery. You can get this UID from getCounterparties() method
'cargo_quantity' => '1', // Amount of packages to ship
'cargo_length' => '10', // Max package Length in Meters
'cargo_height' => '10', // Max package Height in Meters
'cargo_width' => '10', // Max package Width in Meters
'cargo_weight' => '10', // Weight in KG
'cargo_total_volume' => '0.05, // Volume in M3
'cargo_total_weight' => '10', // Total Weight in KG
/* Next lines are NOT required */
'cargo_oversized_weight' => '10', // Total Weight of oversized packages
'cargo_oversized_volume' => '10', // Total Volume of oversized packages
/* Only one is required */
'cargo_freight_uid' => 'xxxx-xxx', // Freight UID
'cargo_freight_name' => 'mybook', // Freight Name
/* --- */
'cargo_hazard_class' => '1.1' // Cargo hazard level. Default and recommended is 0, unsless you know what you are doing
'insurance_value' => '100000', // Insurance value
'insurance_term' => '1', // Boolean flag, that specifies that you need to insure delivery time too
'payment_city' => '7700000000000000000000000' // KLADR Code of payment city
'payment_type' => '1', // Payment type, see below
])
Available Delivery Types
AUTO = 0
EXPRESS = 1
LETTER = 2
AVIA = 3
SMALL = 4
Available Payment Types
CASH = 0
NONCASH = 1
Available Requester Roles
SENDER = 0
RECEIVER = 1
PAYER = 2
THIRD = 3
Available Shipping Types
ADDRESS = 0
TERMINAL = 1
Use Case #2
There are some predefined routes, that will be merged with your routes as well. You may check it by using
php artisan routes:list
It actually exposes the same methods to the routes, so it should be pretty clear on how to use it.
For more information on how to use it, please check out src/ folder.
sergeevpasha/laravel-dellin 适用场景与选型建议
sergeevpasha/laravel-dellin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.92k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 07 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「dellin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sergeevpasha/laravel-dellin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sergeevpasha/laravel-dellin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sergeevpasha/laravel-dellin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP SDK для Деловых Линий
Alfabank REST API integration
Laravel package for Accurate Online API integration.
Shared RCX Laravel DataTables UI and configuration helpers.
Boot a Laravel project on any machine with one command: app:serve installs missing tools (PHP, Node, Composer, Herd, Docker), creates .env, sets up the database, runs migrations, builds assets, starts a queue worker and serves via Herd, Sail or artisan serve; app:down cleanly stops everything it sta
Branded, diagnostic error pages (500, 403, 404, 419, 503) for Filament — native Filament UI, dark mode and translations out of the box.
统计信息
- 总下载量: 1.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-06