All Projects → svenluijten → Env Providers

svenluijten / Env Providers

Licence: mit
👷 Load Laravel service providers based on your application's environment.

Projects that are alternatives of or similar to Env Providers

Flex Env
🌳 Manage your .env file in Laravel projects through artisan
Stars: ✭ 95 (+30.14%)
Mutual labels:  environment-variables, laravel, artisan, package
Artisan View
👀 Manage your views in Laravel projects through artisan
Stars: ✭ 708 (+869.86%)
Mutual labels:  laravel, artisan, package
Webshowu
webshowu—laravel开源项目—秀站分类目录源代码
Stars: ✭ 52 (-28.77%)
Mutual labels:  laravel, artisan
Laravel Reviewable
Adds a reviewable feature to your laravel app.
Stars: ✭ 57 (-21.92%)
Mutual labels:  laravel, package
Variable Injector
Continuous Integration Tool for Swift Projects
Stars: ✭ 63 (-13.7%)
Mutual labels:  environment, environment-variables
Htmlcache
Laravel middleware to cache the rendered html
Stars: ✭ 35 (-52.05%)
Mutual labels:  laravel, package
Laravel Dropbox Driver
A storage extension for Dropbox.
Stars: ✭ 42 (-42.47%)
Mutual labels:  laravel, package
Laravel Opcache
Laravel Package for OPcache
Stars: ✭ 1,116 (+1428.77%)
Mutual labels:  laravel, artisan
Laravel Aws Sns
Laravel package for the AWS SNS Events
Stars: ✭ 24 (-67.12%)
Mutual labels:  laravel, package
Laravel Mentions
End-to-end mentions in Laravel 5.
Stars: ✭ 68 (-6.85%)
Mutual labels:  laravel, package
Watchable
Enable users to watch various models in your application.
Stars: ✭ 65 (-10.96%)
Mutual labels:  laravel, package
Sweet
Official repository for Semantic Web for Earth and Environmental Terminology (SWEET) Ontologies
Stars: ✭ 69 (-5.48%)
Mutual labels:  environment, environment-variables
Laravel Tabler
Laravel Package for integrating Tabler template and this package is Laravel Mix friendly.
Stars: ✭ 20 (-72.6%)
Mutual labels:  laravel, package
Laravel Mention
a laravel user mentioned package
Stars: ✭ 12 (-83.56%)
Mutual labels:  laravel, package
Laravel Packager
A cli tool for creating Laravel packages
Stars: ✭ 1,049 (+1336.99%)
Mutual labels:  laravel, package
Blade Migrations Laravel
An intelligent alternative version of Laravel 5/6 Database Migrations - uses raw-sql syntax, transactions, auto-rollback, UP-DOWN-UP testing
Stars: ✭ 25 (-65.75%)
Mutual labels:  laravel, artisan
Shield
The core shield package.
Stars: ✭ 60 (-17.81%)
Mutual labels:  laravel, package
Conf
Go package for loading program configuration from multiple sources.
Stars: ✭ 70 (-4.11%)
Mutual labels:  environment, environment-variables
Laravel Bootstrap Table List
Bootstrap table list generator for Laravel.
Stars: ✭ 16 (-78.08%)
Mutual labels:  laravel, package
Pagarme Laravel
Pagar.me SDK for Laravel applications.
Stars: ✭ 23 (-68.49%)
Mutual labels:  laravel, package

env-providers

Laravel EnvProviders

Latest Version on Packagist Total Downloads Software License Build Status StyleCI

A more finetuned way of managing your service providers in Laravel. This package allows you to configure the environment certain service providers and aliases are loaded in.

Installation

Via composer:

$ composer require sven/env-providers

Or add the package to your dependencies in composer.json and run composer update to download the package:

{
    "require": {
        "sven/env-providers": "^3.1"
    }
}

Next, add the ServiceProvider to your providers array in config/app.php:

// config/app.php
'providers' => [
    ...
    Sven\EnvProviders\ServiceProvider::class,
];

Usage

You must publish this package's configuration file for it to work properly. To do so, run the following command:

$ php artisan vendor:publish --provider="Sven\EnvProviders\ServiceProvider"

After that, you should see the file config/providers.php. In the created configuration file you can see 2 pre-defined provider groups that will help you set up what providers and aliases should be loaded when the application is in any of the given environments.

Environments

In the environments array you can define what environments the provider group should respond to. You may use an asterisk (*) to make that group's providers and aliases load regardless of the application's environment.

Note: You can set your application's environment in either config/app.php under env or via your .env file. If you want to manage your .env file via php artisan, you can check out sven/flex-env.

Providers

The providers array is where you can put the providers you want to have loaded in the defined environments. This should be pretty straight forward as it is similar to how you would register service providers in config/app.php.

Aliases

In the aliases array you may define all your aliases (facades). As with the providers, this is the same as how you would register aliases in the default config/app.php configuration file.

Example

[
    'environments' => ['local', 'development', 'dev'],
    'providers' => [
        Sven\ArtisanView\ArtisanViewServiceProvider::class,
        Barryvdh\Debugbar\ServiceProvider::class,
    ],
    'aliases' => [
        'Debugbar' => Barryvdh\Debugbar\Facade::class,
    ],
],

Notice how we're only loading the Debugbar ServiceProvider and facade when our application's environment is either local, development, or dev. This means you can't use the Debugbar facade in your project when the environment doesn't match any of those.

Contributing

All contributions (pull requests, issues and feature requests) are welcome. Make sure to read through the CONTRIBUTING.md first, though. See the contributors page for all contributors.

License

sven/env-providers is licensed under the MIT License (MIT). Please see the license file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].