This project serves as boilerplate code to easily setup a devenv environment for laravel.
-
get the boilerplate code
-
either by just using this repository as template
-
or by downloading the source code
project=<YOUR_PROJECT_NAME> # replace <YOUR_PROJECT_NAME> with your project name wget -O laravel-devenv.zip https://github.com/devloberto/laravel-devenv/archive/refs/heads/master.zip unzip laravel-devenv.zip rm laravel-devenv.zip mv laravel-devenv-master $project cd $project # optional but recommended direnv allow . git init && git add . && git commit -m "initial commit"
-
-
scaffold laravel application
The
$laravel_project_directoryenvironment variable is defined at the top of thedevenv.nixfile and its value is equivalent to the directory name that contains the laravel application. The default value islaravel. Change it in thedevenv.nixfile if you want to use a different directory name.scaffold-laravel
The
scaffold-laravelcommand is provided by thedevenv.nixand utilises the laravel CLI. Mind the following: Skip the first step if the laravel CLI asks for upgrading because it can not upgrade itself since it is installed as a nix package by devenv. -
adapt the DB configuration in
./$laravel_project_directory/.env:DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=develobearer DB_USERNAME=develobear DB_PASSWORD=Test-1234
-
start your development environment
devenv up
-
run the database migrations
artisan migrate
Now you should see the laravel page at http://localhost:8000 and the adminer login at http://localhost:8810.
