Laravel simple local development environment setup

Often times we need to setup an instance of a laravel framework for some small project or proof of concept ideas. It’s ideal if we could do it without having to setup a docker instances just for it or not having to maintain a local lamp stack just for these projects.

If you are like me and your core development environment is based on linux, you already have what you need to have a local instance of laravel framework running in no time. Because locally you can simply run it on the built in laravel app server and use sqlite as the database system.

In order to setup sqlite as the database system create a new file called database.sqlite inside the database folder of your laravel framework file system. Then open the .env file and update DB_CONNECTION value to sqlite. This should be enough to run the framework. You can test if it’s running or not by opening up a terminal and typing php artisan server this will start the built in server inside laravel. Browse to http://localhost:8000 and you should see the laravel frameworks landing page.

One caveat though, it seems the unique:users,email validation does not appears to work if you are using the sqlite database to develop locally. But, the simple workaround to this issues is to pass the model instead of the table name (unique:\App\Models\User,email) and it works perfectly.

Do let me know if you also use this approach when developing locally and if you have faced some other issues while doing so.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.