alexanderpoellmann/laravel-post-plc

A laravel integration for the Austrian Post Label Center (Österreichische Post).


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.