highsolutions / laravel-environments
A Laravel package for easy management of different environments (dev, staging, production, etc.).
Installs: 5 158
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.0|>=8.0.2
- illuminate/console: 5.*|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/support: 5.*|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- mockery/mockery: ^1.0
- orchestra/testbench: 3.*|4.*|5.*|6.*|7.*|8.*|9.*|10.*
- phpunit/phpunit: 6.*|7.*|8.*|9.*|10.*|11.*
README
Easy management of different environments in Laravel projects.
Installation
This package can be installed through Composer:
composer require highsolutions/laravel-environments
Or by adding the following line to the require
section of your Laravel webapp's composer.json
file:
"require": { "HighSolutions/laravel-environments": "3.*" }
And run composer update
to install the package.
Then, if you are using Laravel <= 5.4, update config/app.php
by adding an entry for the service provider:
'providers' => [ // ... HighSolutions\LaravelEnvironments\EnvironmentServiceProvider::class, ];
Optionally, publish the configuration file if you want to change any defaults:
php artisan vendor:publish --provider="HighSolutions\LaravelEnvironments\EnvironmentServiceProvider"
This will create new file config/environments.php
with few configuration options for package.
Configuration
Usage
Create a new environment
To create a new environment, just use create
method:
php artisan env:create NAME_OF_ENVIRONMENT
In case that another environment exists with the same name, you can force to overwrite it with --overwrite
option:
php artisan env:create local --overwrite
You can use also predefined make:env
method to be more consistent with other Laravel commands (--overwrite
option is enabled here):
php artisan make:env NAME_OF_ENVIRONMENT
Set environment as active
To copy files to main codebase, just use set
method:
php artisan env:set NAME_OF_ENVIRONMENT
Copy an environment
To make a duplicate of existing environment, just use copy
method:
php artisan env:copy NAME_OF_EXISTING_ENVIRONMENT NAME_OF_NEW_ENVIRONMENT
In case that another environment exists with the same name, you can force to overwrite it with --overwrite
option:
php artisan env:copy old new --overwrite
Remove an environment
To remove an environment, just use remove
method:
php artisan env:remove NAME_OF_ENVIRONMENT
List all environments
To see a list of all environments, just use list
method:
php artisan env:list
Testing
Run the tests with:
vendor/bin/phpunit
Changelog
3.5.0
- Laravel 11.0 support
3.4.0
- Laravel 10.0 support
3.3.0
- Laravel 9.0 support
3.2.0
- Laravel 8.0 support
3.1.0
- Laravel 7.0 support
3.0.0
- Laravel 5.8 and 6.0 support
2.2.0
- Change name of config file from
config/laravel-environments.php
toconfig/environments.php
2.1.0
- Removing files that are exist in base folder but not exist in environment being set to active
2.0.0
- Support for all Laravel 5.* versions (to-date)
1.6.0
- Laravel 5.6 support
1.5.0
- Create, Copy, Remove, Set, List commands
- Unit tests
- Laravel 5.5 Support
Credits
This package is developed by HighSolutions, software house from Poland in love in Laravel.