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

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

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

patryk-sawicki/inpost-laravel

最新稳定版本:1.0.5

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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固