alexanderpoellmann / laravel-post-plc
A laravel integration for the Austrian Post Label Center (Österreichische Post).
v0.1.0
2024-04-28 13:34 UTC
Requires
- php: ^8.1
- illuminate/contracts: ^10.0|^11.0
- ricorocks-digital-agency/soap: ^1.7
- spatie/laravel-data: ^3.9
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
README
Installation
You can install the package via composer:
composer require alexanderpoellmann/laravel-post-plc
You can publish and run the migrations with:
php artisan vendor:publish --tag="laravel-post-plc-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="laravel-post-plc-config"
Finally, add the following entry to your services.php
config file:
'post-plc' => [ 'client-id' => env('PLC_CLIENT_ID'), 'org-unit-id' => env('PLC_ORG_UNIT_ID'), 'org-unit-guid' => env('PLC_ORG_UNIT_GUID'), 'sandbox' => env('PLC_SANDBOX', false), ],
Usage
use AlexanderPoellmann\LaravelPostPlc\Classes\Address; use AlexanderPoellmann\LaravelPostPlc\Classes\Collo; use AlexanderPoellmann\LaravelPostPlc\Classes\Shipment; use AlexanderPoellmann\LaravelPostPlc\Facades\LaravelPostPlc; $from = (new Address()) ->id(sprintf('%05d', mt_rand(1, 10000))) ->name('Absender GmbH') ->route('Rochusmarkt') ->street_number('5') ->post_code('1030') ->city('Wien') ->country_code('AT') ->get(); $to = (new Address()) ->id(sprintf('%05d', mt_rand(1, 10000))) ->name('Musterfirma GmbH', 'c/o Frau Maria Muster') ->route('Landesgerichtsstraße') ->street_number('1') ->post_code('1010') ->city('Wien') ->country_code('AT') ->get(); $shipment = (new Shipment()) ->withPrinter() ->withNumber(sprintf('%05d', mt_rand(1, 10000))) ->using(PostProductCodes::PaketPremiumOesterreichB2B) ->from($from) ->to($to) ->parcels([ (new Collo())->weight(0.4)->get(), (new Collo())->weight(5.2)->get(), ])->get(); LaravelPostPlc::call(ServiceMethods::ImportShipment, $shipment, true); $object = LaravelPostPlc::toCollection(); dd($object);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.