Environment for laravel applications with mysql
daxter1987/laravel-env is a Laravel package for environment for laravel applications with mysql.
It currently has 0 GitHub stars and 14.765 downloads on Packagist (latest version v1.0.7).
Install it with composer require daxter1987/laravel-env.
Discover more Laravel packages by daxter1987
or browse all Laravel packages to compare alternatives.
Last updated
By installing this composer package into your laravel application, this enables the php artisan dax:install command, which creates a docker-compose.yml and a daxenv.sh file into your laravel root directory. Then you can run docker compose up -d and you have a laravel environment with a database.
composer require daxter1987/laravel-env
php artisan dax:install
This creates 2 files:
This also checks the .gitignore in your laravel project and adds the line /db if it doesn't exist. This is the folder where docker will store your local database container volume.
If you want to use the shortcuts give the daxenv.sh file executing permissions by running the command:
sudo chmod 777 daxenv.sh
The database connection credentials can be found in your newly created docker-compose.yml file. Make sure the database connection is properly configured either in your .env file or your config/database.php file.
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: db
MYSQL_USER: root
MYSQL_PASSWORD: root
To start the environment run
./daxenv.sh up
To stop the environment
./daxenv.sh down
To ssh into the laravel container
./daxenv.sh ssh
To start the environment run
docker-compose up -d
To stop the environment
docker-compose down
To ssh into the laravel container run docker container ls to get the name of the container, then replace the container name for CONTAINER_NAME in the command below
docker exec -it CONTAINER_NAME ssh
The container comes with xdebug installed (if you run phpinfo() you would see the configuration). To use it, set up PHPStorm:
Go to Languages and Frameworks > PHP > Servers and set
Go to "Add Configurations"
?XDEBUG_SESSION_START=PHPSTORM