webapix / laravel-mygls
Laravel version of the MyGLS REST API integration.
Fund package maintenance!
patrons.webapix.hu
Installs: 9 788
Dependents: 0
Suggesters: 0
Security: 0
Stars: 15
Watchers: 3
Forks: 3
Open Issues: 0
Requires
- php: ^7.2|^8.0|^8.1|^8.2|^8.3
- ext-json: *
- illuminate/support: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- webapix/mygls-sdk: ^1.0.0
Requires (Dev)
- mockery/mockery: ^1.3.3
- orchestra/testbench: ^5.0|^6.0|^7.0|^8.0|^9.0
- phpunit/phpunit: ~6.0 || ^7.5.15 || 8.5.22 || ^9.3.3 || ^9.5.10 || ^10.0 || ^11.0
README
This is the Laravel version of our MyGLS REST API integration.
Installation
You can install the package via composer:
composer require webapix/laravel-mygls
Configuration
Publish package
Create config/my-gls.php configuration file using the following artisan command:
php artisan vendor:publish --provider="Webapix\GLS\Laravel\MyGlsServiceProvider"
Add your account
Open .env file and set:
MYGLS_API_URL
MYGLS_CLIENT_NUMBER
MYGLS_USERNAME
MYGLS_PASSWORD
Usage
use \Webapix\GLS\Requests\GetParcelStatuses; $request = new GetParcelStatuses(12345678); /** @var \Webapix\GLS\Responses\GetParcelStatuses $response */ $response = app(\Webapix\GLS\Laravel\Client::class)->request($request); // Or use the facade: $response = MyGls::request($request); if ($response->successfull()) { /** @var \Webapix\GLS\Models\ParcelStatus[] */ $parcelStatusList = $response->parcelStatusList(); foreach ($parcelStatusList as $parcelStatus) { $parcelStatus->depotCity(); $parcelStatus->depotNumber(); $parcelStatus->statusCode(); $parcelStatus->statusDate(); $parcelStatus->statusDescription(); $parcelStatus->statusInfo(); } }
You can find more information and examples in our wiki.
Accounts
By default, the MyGLS client use the default account.
You can use multiple accounts:
// add your new account to config/my-gls.php [ 'accounts' => [ 'my-new-account' => [ 'api_url' => '', 'client_number' => '', 'username' => '', 'password' => '', ] ] ] MyGls::on('my-new-account')->request(...);
Docs
Package docs
Official GLS Docs
Testing
composer test
Postcardware
According to the postcardware concept, if you use the software for your project(s) we would appreciate to receive a postcard of your hometown.
Please send it to:
WEBAPIX KFT.
Kőris utca 2/E, 2/1
2051 Biatorbágy
Hungary
Support us
If you find our packages useful and would like to support our work in maintaining and regularly updating them, consider becoming a patron. Any size of donation is welcome and highly appreciated.
Contributing
Contributions are welcome! When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security
If you discover any security related issues, please email pdo@webapix.hu instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.