定制 patryk-sawicki/inpost-laravel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

patryk-sawicki/inpost-laravel

Composer 安装命令:

composer require patryk-sawicki/inpost-laravel

包简介

InPost ShipX API client for laravel.

README 文档

README

InPost ShipX API client for laravel.

Based on aPaczka api doc.

Requirements

  • PHP 7.4 or higher with json extensions.

Installation

The recommended way to install is through Composer.

composer require patryk-sawicki/inpost-laravel

Usage

Add to env:

INPOST_API_KEY = 'your_api_key'

Import class:

use PatrykSawicki\InPost\app\Classes\InPost;

Organizations

List

Get organizations list.

InPost::organizations()->list(array $options = [], bool $returnJson = false);

Get

Get organizations details.

InPost::organizations()->get(int $id, bool $returnJson = false);

Statistics

Get organizations statistics.

InPost::organizations()->statistics(int $id, bool $returnJson = false);

Services

Get a list of the available services.

InPost::services()->list(bool $returnJson = false);

Points

List

Get a list of the available points.

InPost::points()->list(array $options = [], bool $returnJson = false);

Get

Get a point details.

InPost::points()->get(string $name, bool $returnJson = false);

Shipment

Send

Send a new shipment.

use PatrykSawicki\InPost\app\Classes\InPost;
use PatrykSawicki\InPost\app\Models\Cash as InPostCash;
use PatrykSawicki\InPost\app\Models\Dimensions as InPostDimensions;
use PatrykSawicki\InPost\app\Models\Weight as InPostWeight;
use PatrykSawicki\InPost\app\Models\Address as InPostAddress;
use PatrykSawicki\InPost\app\Models\Parcel as InPostParcel;
use PatrykSawicki\InPost\app\Models\Parcels as InPostParcels;
use PatrykSawicki\InPost\app\Models\Receiver as InPostReceiver;
use PatrykSawicki\InPost\app\Models\Sender as InPostSender;

$shipment = InPost::shipment();

/*Set organization*/
$shipment->setOrganizationId(123);

/*Receiver*/
$receiverAddress = new InPostAddress('street', 'building_number', 'city', 'post_code', 'PL');
$receiver = new InPostReceiver('name', 'company name', 'first name', 'last name', 'e-mail', 'phone', $receiverAddress);
$shipment->setReceiver($receiver);

/*Sender - Optional*/
$senderAddress = new InPostAddress('street', 'building_number', 'city', 'post_code', 'PL');
$sender = new InPostSender('name', 'company name', 'first name', 'last name', 'e-mail', 'phone', $senderAddress);
$shipment->setSender($sender);

/*Parcels*/
$dimensions = new InPostDimensions(10, 10, 10, 'mm');
$weight = new InPostWeight(10, 'kg');
$firstParcel = new InPostParcel($dimensions, $weight, 'parcel 1');

/*Second parcel is optional.*/
$dimensions = new InPostDimensions(20, 20, 20, 'mm');
$weight = new InPostWeight(5, 'kg');
$secondParcel = new InPostParcel($dimensions, $weight, 'parcel 2');

$shipment->setParcels(new InPostParcels($firstParcel, $secondParcel));

/*Insurance - Optional*/
$insurance = new InPostCash(100, 'PLN');
$shipment->setInsurance($insurance);

/*Cod - Optional*/
$cod = new InPostCash(100, 'PLN');
$shipment->setCod($cod);

/*Additional Services - Optional*/
$shipment->setAdditionalServices(['sms', 'email']);

/*Reference - Optional*/
$shipment->setReference('reference');

/*Comments - Optional*/
$shipment->setComments('comments');

/*External customer id - Optional*/
$shipment->setExternalCustomerId('external customer id');

/*MPK - Optional*/
$shipment->setMpk('mpk');

/*Is return - Optional*/
$shipment->setIsReturn(false);

/*Service*/
$shipment->setService('inpost_locker_standard');

/*Custom attributes - Optional*/
$shipment->setCustomAttributes(['target_point' => 'xxx']);

/*Only choice of offer - Optional*/
$shipment->setOnlyChoiceOfOffer(true);

/*Send shipment*/
$shipment->send(bool $returnJson = false);

Cancel

Cancellation of a shipment.

InPost::shipment()->cancel(int $id, bool $returnJson = false);

Label

Get label for a shipment.

return InPost::shipment()->label(int $id, string $format = 'pdf', string $type = 'normal');

Tracking

Get a tracking details.

InPost::tracking()->get(string $tracking_number, bool $returnJson = false);

Statuses

Get a list of the available statuses.

InPost::statuses()->list(bool $returnJson = false);

Dispatch orders

Create

Create a new dispatch orders.

use PatrykSawicki\InPost\app\Classes\InPost;
use PatrykSawicki\InPost\app\Models\Address as InPostAddress;

$dispatchOrders = InPost::dispatchOrders();

/*Set organization*/
$dispatchOrders->setOrganizationId(2324);

/*Set shipments*/
$dispatchOrders->setShipments(1, 2, 3, 4);

/*Set comments - Optional*/
$dispatchOrders->setComments('Test');

/*Set address*/
$dispatchOrders->setAddress(new InPostAddress('street', 'building_number', 'city', 'post_code', 'PL'));

/*Set office hours - Optional*/
$dispatchOrders->setOfficeHours('09:00 - 18:00');

/*Set name*/
$dispatchOrders->setName('Patryk Sawicki');

/*Set phone*/
$dispatchOrders->setPhone('+48793202257');

/*Set email - Optional*/
$dispatchOrders->setEmail('patryk@patryksawicki.pl');

/*Create a new dispatch orders.*/
$dispatchOrders->create(bool $returnJson = false);

Cancel

Cancellation of a dispatch orders

InPost::dispatchOrders()->cancel(int $id, bool $returnJson = false);

List

Get dispatch orders list.

$dispatchOrders = InPost::dispatchOrders();

/*Set organization*/
$dispatchOrders->setOrganizationId(2324);


$dispatchOrders->list(bool $returnJson = false);

Get

Get dispatch orders details.

$dispatchOrders->get(int $id, bool $returnJson = false);

Add comment

Add comment to dispatch orders.

$dispatchOrders = InPost::dispatchOrders();

/*Set organization*/
$dispatchOrders->setOrganizationId(123456);

$dispatchOrders->addComment(int $dispatch_order_id, string $comment, bool $returnJson = false);

Update comment

Update comment in dispatch orders.

$dispatchOrders = InPost::dispatchOrders();

/*Set organization*/
$dispatchOrders->setOrganizationId(123456);

$dispatchOrders->updateComment(int $dispatch_order_id, int $comment_id, string $comment, bool $returnJson = false);

Update comment

Update comment in dispatch orders.

$dispatchOrders = InPost::dispatchOrders();

/*Set organization*/
$dispatchOrders->setOrganizationId(123456);

$dispatchOrders->removeComment(int $dispatch_order_id, int $comment_id, bool $returnJson = false);

Changelog

Changelog is available here.

patryk-sawicki/inpost-laravel 适用场景与选型建议

patryk-sawicki/inpost-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.15k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2022 年 08 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 patryk-sawicki/inpost-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 patryk-sawicki/inpost-laravel 我们能提供哪些服务?
定制开发 / 二次开发

基于 patryk-sawicki/inpost-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 11.15k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 2
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-10