Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jenky/laravel-envloader
Laravel 5 environment loader
https://github.com/jenky/laravel-envloader
Last synced: 4 days ago
JSON representation
Laravel 5 environment loader
- Host: GitHub
- URL: https://github.com/jenky/laravel-envloader
- Owner: jenky
- Created: 2015-04-01T06:30:57.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-09-15T08:35:30.000Z (over 7 years ago)
- Last Synced: 2024-12-10T23:30:35.707Z (28 days ago)
- Language: PHP
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Laravel 5 environment loader
[![Latest Stable Version](https://poser.pugx.org/jenky/laravel-envloader/v/stable.svg)](https://packagist.org/packages/jenky/laravel-envloader)
[![Total Downloads](https://poser.pugx.org/jenky/laravel-envloader/d/total.svg)](https://packagist.org/packages/jenky/laravel-envloader)
[![License](https://poser.pugx.org/jenky/laravel-envloader/license.svg)](https://packagist.org/packages/jenky/laravel-envloader)Load configs, providers, aliases based on the `APP_ENV` name in `.env`.
## Installation
Require this package with composer:```
composer require jenky/laravel-envloader ~1.0
```or add this to `composer.json`
```
"jenky/laravel-envloader": "~1.0"
```After updating composer, add the ServiceProvider to the providers array in `config/app.php`. Make sure the `EnvLoaderServiceProvider` is loaded before other app service providers.
```php
'Jenky\LaravelEnvLoader\EnvLoaderServiceProvider',
// or
Jenky\LaravelEnvLoader\EnvLoaderServiceProvider::class, // PHP 5.5/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
// ...
```Copy the package config to your local config with the publish command:
```
php artisan vendor:publish
```
The config files will be published to `config/app/env`## Usage
Modify the config files in `config/app/env` to suite your needs
```php
/* configs.php */return [
'local' => [
'app' => [
'url' => 'http://myapp.local',
],
],
'sandbox' => [
'app' => [
'url' => 'http://sandbox.myapp.com',
],
],
'testing' => [
'session' => [
'driver' => 'file',
],
],
];
```Multiple environments may be delimited using a "pipe" character
```php
/* aliases.php */return [
'local|staging' => [
'Debugbar' => 'Barryvdh\Debugbar\Facade',
],
];
```