avto-dev / static-references-laravel
Static references for Laravel applications
Installs: 31 270
Dependents: 1
Suggesters: 1
Security: 0
Stars: 1
Watchers: 1
Forks: 6
Open Issues: 0
Requires
- php: ^8.1
- ext-json: *
- avto-dev/static-references-data: ^3.0
- illuminate/support: ~10.0 || ~11.0
Requires (Dev)
- laravel/laravel: ~10.0 || ~11.0
- mockery/mockery: ^1.6.5
- phpstan/phpstan: ^1.10.66
- phpunit/phpunit: ^10.5
README
Wrappers around data from static-references-data
Using this package you can get access to the data from package avto-dev/static-references-data simpler and more convenient.
Service-provider for integration with Laravel application comes too.
Install
Require this package with composer using the following command:
$ composer require avto-dev/static-references-laravel "^4.0"
Installed
composer
is required (how to install composer).
You need to fix the major version of package.
Usage
Use illuminate service container for getting access to the references instances. For example, in artisan command:
<?php namespace App\Console\Commands; use AvtoDev\StaticReferences\References\SubjectCodes; use AvtoDev\StaticReferences\References\VehicleCategories; class SomeCommand extends \Illuminate\Console\Command { /** * The console command name. * * @var string */ protected $name = 'some:command'; /** * Execute the console command. * * @param SubjectCodes $subject_codes * @param VehicleCategories $vehicle_categories * * @return void */ public function handle(SubjectCodes $subject_codes, VehicleCategories $vehicle_categories): void { // Print all vehicle categories in a one string $this->info(collect($vehicle_categories)->pluck('code')->implode(', ')); // A, A1, B, BE... // Get all GIBDD codes for moscow subject $this->info($subject_codes->getByGibddCode(77)->getGibddCodes()); // [77, 97, 99, 177, ...] // Make GIBDD codes validation $subject_codes->hasGibddCode(777); // true $subject_codes->hasGibddCode(666); // false } }
All available references can be found in this directory.
Testing
For package testing we use phpunit
framework and docker-ce
+ docker-compose
as develop environment. So, just write into your terminal after repository cloning:
$ make build $ make latest # or 'make lowest' $ make test
Changes log
Changes log can be found here.
Support
If you will find any package errors, please, make an issue in current repository.
License
This is open-sourced software licensed under the MIT License.