avto-dev / static-references-laravel
Laravel应用程序的静态引用
v4.6.0
2024-05-31 11:32 UTC
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
对static-references-data
数据的包装
使用此包,您可以更简单、更方便地访问avto-dev/static-references-data包中的数据。
提供与Laravel应用程序集成的服务提供商。
安装
使用以下命令通过composer安装此包
$ composer require avto-dev/static-references-laravel "^4.0"
需要安装
composer
(如何安装composer)。
您需要修复包的主要版本。
用法
使用illuminate服务容器来访问引用实例。例如,在artisan命令中
<?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 } }
所有可用的引用都可以在此目录中找到。
测试
为了测试包,我们使用phpunit
框架和docker-ce
+ docker-compose
作为开发环境。因此,在克隆存储库后,只需在您的终端中写下
$ make build $ make latest # or 'make lowest' $ make test
变更日志
变更日志可以在这里找到。
支持
如果您发现任何包错误,请在此存储库中创建问题。
许可
这是一个开源软件,许可协议为MIT License。