2017 © Pedro Peláez
 

library periods

Laravel 5 package to add suport for historical data using multiple databases

image

acacha/periods

Laravel 5 package to add suport for historical data using multiple databases

  • Friday, November 11, 2016
  • by acacha
  • Repository
  • 1 Watchers
  • 1 Stars
  • 379 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 22 % Grown

The README.md

periods

Latest Version on Packagist ![Software License][ico-license] Build Status ![Coverage Status][ico-scrutinizer] Quality Score ![Total Downloads][ico-downloads], (*1)

Laravel 5 packages to support multiple database connections for historical data (One period -> One database connection), (*2)

Install

Via Composer, (*3)

``` bash $ composer require acacha/periods, (*4)


Add **PeriodsServiceProvider** service provider to **config/app.php** file: ```php ... /* * Package Service Providers... */ Acacha\Periods\Providers\PeriodsServiceProvider::class, ...

Publish files with:, (*5)

php artisan vendor:publish --tag=acacha_periods

Usage

Register Laravel Middleware on class App\Http\Kernel.php at the end of web middleware group:, (*6)

``` php ... protected $middlewareGroups = [ 'web' => [ ... \Acacha\Periods\Middleware\Periods::class ], ..., (*7)


Customize your config. First adapt to your needs fil **config/periods.php**: ```php <?php return [ /* |-------------------------------------------------------------------------- | Session variable name for periods |-------------------------------------------------------------------------- | | This value is the name of the session vairable that storages desired period. */ 'session_variable' => 'ACACHA_PERIOD', /* |-------------------------------------------------------------------------- | Valid period values and related database connections |-------------------------------------------------------------------------- | | This value is an array that stores valid period values and his related | database connections. */ 'periods' => [ '2016-17' => env('DB_CONNECTION', 'mysql'), '2015-16' => env('DB_CONNECTION', 'mysql') . '_1516', '2014-15' => env('DB_CONNECTION', 'mysql') . '_1415', ], ];

By sure that you have multiple database connections (default sqlite, sqlite_1516, sqlite_1415...) at config file config/database.php:, (*8)

...
    'connections' => [

        'sqlite' => [
            'driver' => 'sqlite',
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => '',
        ],

        'sqlite_1516' => [
            'driver' => 'sqlite',
            'database' => env('DB_DATABASE', database_path('database1516.sqlite')),
            'prefix' => '',
        ],

        'sqlite_1415' => [
            'driver' => 'sqlite',
            'database' => env('DB_DATABASE', database_path('database1415.sqlite')),
            'prefix' => '',
        ],
...

Change log

Please see CHANGELOG for more information what has changed recently., (*9)

Testing

bash $ composer test, (*10)

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*11)

Security

If you discover any security related issues, please email sergiturbadenas@gmail.com instead of using the issue tracker., (*12)

Credits

License

The MIT License (MIT). Please see License File for more information., (*13)

The Versions

11/11 2016

dev-master

9999999-dev https://github.com/acacha/periods

Laravel 5 package to add suport for historical data using multiple databases

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

The Development Requires

acacha periods

11/11 2016

0.1.0

0.1.0.0 https://github.com/acacha/periods

Laravel 5 package to add suport for historical data using multiple databases

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

The Development Requires

acacha periods