Laravel DynamicExpress API Wrapper
DynamicExpress API Documentation
You can install the package via composer:
composer require gdinko/dynamicexpress
If you plan to use database for storing nomenclatures:
php artisan migrate
If you need to export configuration file:
php artisan vendor:publish --tag=dynamicexpress-config
If you need to export migrations:
php artisan vendor:publish --tag=dynamicexpress-migrations
If you need to export models:
php artisan vendor:publish --tag=dynamicexpress-models
If you need to export commands:
php artisan vendor:publish --tag=dynamicexpress-commands
DYNAMICEXPRESS_API_USER=
DYNAMICEXPRESS_API_PASS=
DYNAMICEXPRESS_API_WSDL= #default = https://system.dynamicexpress.eu/schema.wsdl
Runtime Setup
DynamicExpress::setAccount('user', 'pass');
DynamicExpress::addAccountToStore('AccountUser', 'AccountPass');
DynamicExpress::getAccountFromStore('AccountUser');
DynamicExpress::setAccountFromStore('AccountUser');
Multiple Account Support In AppServiceProvider add accounts in boot method
public function boot()
{
DynamicExpress::addAccountToStore(
'AccountUser',
'AccountPass'
);
DynamicExpress::addAccountToStore(
'AccountUser_XXX',
'AccountPass_XXX'
);
}
Commands
#sync countries with database (use -h to view options)
php artisan dynamic-express:sync-countries
#sync cities with database (use -h to view options)
php artisan dynamic-express:sync-cities
#sync offices with database (use -h to view options)
php artisan dynamic-express:sync-offices
#create cities map with other carriers in database (use -h to view options)
php artisan dynamic-express:map-cities
#sync all nomenclatures with database (use -h to view options)
php artisan dynamic-express:sync-all
#get payments (use -h to view options)
php artisan dynamic-express:get-payments
#get dynamic express api status (use -h to view options)
php artisan dynamic-express:api-status
#track parcels (use -h to view options)
php artisan dynamic-express:track
Models
CarrierDynamicExpressCountry
CarrierDynamicExpressCity
CarrierDynamicExpressOffice
CarrierDynamicExpressPayment
CarrierDynamicExpressApiStatus
CarrierDynamicExpressTracking
Events
CarrierDynamicExpressTrackingEvent
CarrierDynamicExpressPaymentEvent
- Subscribe to tracking event, you will recieve last tracking info, if tracking command is schduled
Event::listen(function (CarrierDynamicExpressTrackingEvent $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 TrackCarrierDynamicExpress
- In app/Console/Commands/TrackCarrierDynamicExpress define your logic for parcels to be tracked
use Gdinko\DynamicExpress\Commands\TrackCarrierDynamicExpressBase;
class TrackCarrierDynamicExpressSetup extends TrackCarrierDynamicExpressBase
{
protected function setup()
{
//define parcel selection logic here
// $this->parcels = [];
}
}
- Use the command
php artisan dynamic-express:track
Calculate price
$data = [
// value is taken with getServices Method. Here 1 is ->
// -> "Бързи градски услуги" (fast urban services)
'service' => 1,
// value is taken with getSubServices Method. ->
// -> Here 18 is "48 часа икономична" (48h economical)
'subservice' => 18,
// 0(zero) or 1 (1 if there will be fixed delivery, 0 if not)
'fix_chas' => 0,
// 0(zero) or 1 (1 if there will be return reciept, 0 if not)
'return_receipt' => 0,
// 0(zero) or 1 (1 if there will be return document, 0 if not)
'return_doc' => 0,
// COD(cash on delivery). 0(zero) if there is no COD. ->
// -> USE "."(dot) for decimals!
'nal_platej' => 50,
// Insurance Value. 0(zero) if there is no insurance. ->
// -> USE "."(dot) for decimals!
'zastrahovka' => 50,
// Weigth in kg. CAN'T be 0(zero). Use "."(dot) for decimals.
'teglo' => 2.5,
// ID of the country(ISO standart). ->
// -> Required only for international delivery
'country_b' => 100,
];
$priceData = DynamicExpress::calculate($data);
dd($priceData);
You can use all methods from the WDSL Schema Like this:
DynamicExpress::getMyObjectInfo();
DynamicExpress::getMyObjects();
DynamicExpress::getOfficesCity();
DynamicExpress::getOfficesCord(100);
DynamicExpress::getSoapCouriers();
//and so on , see the documentation
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email dinko359@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.