pamekar/laravel-postnl-api
Composer 安装命令:
composer require pamekar/laravel-postnl-api
包简介
Laravel PostNL API package
README 文档
README
Intergrates the PostNL API with Laravel 5 & 6 via a ServiceProvider and Facade.
Instalation
composer require deniztezcan/laravel-postnl-api
Add a ServiceProvider to your providers array in config/app.php:
'providers' => [ //other things here DenizTezcan\LaravelPostNLAPI\PostNLAPIServiceProvider::class, ];
Add the facade to the facades array:
'aliases' => [ //other things here 'PostNLAPI' => DenizTezcan\LaravelPostNLAPI\Facades\PostNLAPI::class, ];
Finally, publish the configuration files:
php artisan vendor:publish --provider="DenizTezcan\LaravelPostNLAPI\PostNLAPIServiceProvider"
Configuration
Please set your API: url, key and Customer code, number, location, email and address in the config/postnlapi.php
Usage
To generate a barcode you can use the following call. To find which type and serie to use please check PostNL documentation
$barcode = PostNLAPI::generateBarcode('3S', '00000000000-99999999999');
To generate a label you can use the following call. To find which PrinterType, AddressType and ProductCodeDelivery to use please check PostNL documentation
use DenizTezcan\LaravelPostNLAPI\Entities\{Address, Contact}; $label = PostNLAPI::generateLabel( $barcode, 'GraphicFile|PDF', [Address::create([ 'AddressType' => '01', 'City' => "Testdorp", 'CompanyName' => "Crusty Crab BV", 'Countrycode' => "NL", 'HouseNr' => "1", 'Street' => "Teststraat", 'Zipcode' => "1111AA", 'FirstName' => "Meneer", 'Name' => "Krabs" ]), Address::create([ 'AddressType' => '09', 'City' => "Testdorp", 'CompanyName' => "Crusty Crab BV", 'Countrycode' => "NL", 'HouseNr' => "1", 'Street' => "Teststraat", 'Zipcode' => "1111AA", 'FirstName' => "Meneer", 'Name' => "Krabs" ])], [Contact::create([ 'ContactType' => "01", 'Email' => 'test@meneer.nl', 'SMSNr' => '061111111', 'TelNr' => '061111111' ])], '01', '3085', 'This is a reference', 'This is a remark' );
Note: Watch the Array which needs to be passed in the second and third parameter! Without this it will simply not work!
To get an array of the nearest PostNL locations you can use the following call. You have to pass the CountryCode and PostalCode as parameters.
$locations = PostNLAPI::nearestLocations('NL', '1111AA');
pamekar/laravel-postnl-api 适用场景与选型建议
pamekar/laravel-postnl-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.2k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 04 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pamekar/laravel-postnl-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pamekar/laravel-postnl-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.2k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-04-01