gdinko / acs
Laravel ACS API Wrapper
v1.0.2
2022-05-27 11:11 UTC
Requires
- php: ^7.4|^8.0
- guzzlehttp/guzzle: ^7.4
- illuminate/support: ^8.0|^9.0
Requires (Dev)
- nunomaduro/collision: ^5.11
- nunomaduro/larastan: ^1.0
- orchestra/testbench: ^6.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.2
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.1
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-10-27 16:41:01 UTC
README
Installation
You can install the package via composer:
composer require gdinko/acs
If you plan to use database for storing nomenclatures:
php artisan migrate
If you need to export configuration file:
php artisan vendor:publish --tag=acs-config
If you need to export migrations:
php artisan vendor:publish --tag=acs-migrations
If you need to export models:
php artisan vendor:publish --tag=acs-models
If you need to export commands:
php artisan vendor:publish --tag=acs-commands
Configuration
ACS_API_KEY= ACS_COMPANY_ID= ACS_COMPANY_PASSWORD= ACS_USER_ID= ACS_USER_PASSWORD= ACS_BILLING_CODE= ACS_API_BASE_URL= #default=https://webservices.acscourier.net/ACSRestServices/api/ACSAutoRest/ ACS_API_TIMEOUT= #default=5
Usage
Runtime Setup
Acs::setTimeout(99);
/** * You can call all methods from the API like this , there is no need * to pass company data every time. The data is injected automaticaly * on every request **/ dd(Acs::ACS_Address_Validation([ 'Address' => 'Address ...' ])); dd(Acs::ACS_Trackingsummary([ 'Voucher_No' => '999999999' ]));
Commands
#get acs api status (use -h to view options) php artisan acs:api-status #track parcels (use -h to view options) php artisan acs:track
Models
CarrierAcsTracking CarrierAcsApiStatus
Events
CarrierAcsTrackingEvent
Parcels Tracking
- Subscribe to tracking event, you will recieve last tracking info, if tracking command is schduled
Event::listen(function (CarrierAcsTrackingEvent $event) { echo $event->account; dd($event->tracking); });
- Before use of tracking command you need to create your own command and define setUp method
php artisan make:command TrackCarrierAcs
- In app/Console/Commands/TrackCarrierAcs define your logic for parcels to be tracked
use Gdinko\Acs\Commands\TrackCarrierAcsBase; class TrackCarrierAcsSetup extends TrackCarrierAcsBase { protected function setup() { //define parcel selection logic here // $this->parcels = []; } }
- Use the command
php artisan acs:track
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email dinko359@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.