DEV Community

Cover image for πŸš€ Initializer for Laravel – Jumpstart your next project
Niclas van Eyk
Niclas van Eyk

Posted on

πŸš€ Initializer for Laravel – Jumpstart your next project

Creating a new Laravel application can be as easy as running:

curl -s https://laravel.build/my-new-laravel-application | bash
Enter fullscreen mode Exit fullscreen mode

This does a lot of the heavy lifting for you, but chances are that you have your own preferences and standards. Maybe you always work with PostgreSQL instead of the default MySQL or you would like to utilize one of the application starter kits, rather than rolling your own authentication implementation. Then you need to repeat all of these steps every time you start a new project: installing composer packages, adjusting .env files and running a bunch of php artisan my-package:install commands.

To automate all of this setup, I created laravel.initializer.dev. It presents you with all of the first-party and related packages and their options, so you can pick and choose your favorite Laravel components. Once you're done, just hit the red generate button and a ZIP file will be generated containing your project. If you want to re-use the configuration to generate projects in the future, just click the "Share" button, to generate a link to your configuration.

Now all thats left is unpacking the archive, cding into the project directory, and finally running

./initialize
Enter fullscreen mode Exit fullscreen mode

in your terminal. Have a fresh cup of coffee/tea, while initialize scaffolds out your project, installs all the necessary components, builds your frontend bundles and migrates your database.

Did you chose Postgres as your database? The config/database.php, .env.template and .env files are adjusted accordingly.

Did you chose Horizon to monitor your Redis queues and Mailhog to test your emails locally? There already is a helpful table inside the generated readme.md, which lists the paths to all these local development tools for your setup.

Did you include Pest for your tests and Breeze or Jetstream as a starter kit? Of course all the necessary options were passed during the installation, so all your tests already use Pest.

If you are interested to take a look behind the scenes, the projects code is freely available on GitHub. Feel free to create an issue if you can think of any improvements! (though keep in mind that the project is scoped to first-party Laravel packages atm. Otherwise all of the Spatie packages would take up the whole page)

Top comments (0)