Skip to content

Boost your Laravel app by registering Prod services only on Prod.

License

Notifications You must be signed in to change notification settings

forngo/laravel-dev-booter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel 5 dev booter

SensioLabsInsight

StyleCI Dependency Status Build Status Latest Stable Version Total Downloads Latest Unstable Version License

So many times we find ourselves registering Service Providers that are only needed during development in the providers array. This could slow down our application by registering providers that we do not need in production.

This packages helps you boost your application by only registring these packages in the development environments.

Installation

This packages works for Laravel versions 5.* only.

First install the package using your main ally: composer

composer require percymamedy/laravel-dev-booter

Add the Service Provider to your providers array in config/app.php

'providers' => [
    ...
    PercyMamedy\LaravelDevBooter\ServiceProvider::class,
],

Configuration and usage

Once installed you can now publish your config file and set your correct configuration for using the package.

php artisan vendor:publish --provider="PercyMamedy\LaravelDevBooter\ServiceProvider" --tag="config"

This will create a file config/dev-booter.php.

You may now set your development environments in config/dev-booter.php

'dev_environments' => [
    'local',
    'dev',
    'testing'
],

You can also set where you want your dev ServiceProviders to be loaded from.

'dev_providers_config_key' => 'app.dev_providers'

You can also specify where you want to place your dev class aliases.

'dev_aliases_config_key' => 'app.dev_aliases'

Now all you need is to set your Dev ServiceProviders in config/app.php as you would for regular ServiceProviders. Except that now there is a clean separation of the two and unwanted ServiceProviders will not be loaded or registered in your production environment.

'dev_providers' => [
  ...
]

You may also boot class aliases that may only be used on dev enviroment. You only need to add to your config/app.php the key 'dev_aliases' and place all your dev class aliases there. Now those aliases or facades will only be booted on development.

'dev_aliases' => [
  ...
]

Credits

Percy Mamedy

Twitter: @PercyMamedy
GitHub: percymamedy

About

Boost your Laravel app by registering Prod services only on Prod.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%