avto-dev/static-references-laravel

Static references for Laravel applications

v4.3.0 2020-12-04 10:16 UTC

README

Laravel

Wrappers around data from static-references-data

Version PHP Version Build Status Coverage Downloads count License

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

Release date Commits since latest release

Changes log can be found here.

Support

Issues Issues

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.