/ShipmentTracker

A package to easily track the status of you parcel. With support for multiple providers (BPost, PostNL and DHL)

Primary LanguagePHPMIT LicenseMIT

Shipment Tracker

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

Package Description

A package to easily track the status of you parcel. With support for multiple providers (BPost, PostNL and DHL). A provider can be added by creating an adapter for the new provider.

Installation

You can install the package via composer:

composer require libaro/shipmenttracker

You can publish the config file with:

php artisan vendor:publish --tag="shipment-tracker"

This is the contents of the published config file:

return [
    'providers' => [
        [
            'name' => 'bpost',
            'label' => 'BPost',
            'adapter' => \Libaro\ShipmentTracker\Adapters\BPostAdapter::class,
            'barcode_tags' => [3232],
            'credentials' => [
                'username' => env('SHIPMENT_TRACKER_BPOST_USERNAME'),
                'password' => env('SHIPMENT_TRACKER_BPOST_PASSWORD'),
            ],
        ],
        [
            'name' => 'post_nl',
            'label' => 'PostNL',
            'adapter' => \Libaro\ShipmentTracker\Adapters\PostNLAdapter::class,
            'barcode_tags' => ['3S', 'CD'],
            'credentials' => [
            ],
        ],
        [
            'name' => 'dhl',
            'label' => 'DHL',
            'adapter' => \Libaro\ShipmentTracker\Adapters\DhlAdapter::class,
            'barcode_tags' => [],
            'credentials' => [
                'api_key' => env('SHIPMENT_TRACKER_DHL_API_KEY'),
                'api_secret' => env('SHIPMENT_TRACKER_DHL_API_SECRET')
            ],
        ],
    ],
];

Usage

You can use the Shipment facade to track your parcel.

Shipment::track('5995390550944994')

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.