This post is also available in:
Português
Laravel 12 has arrived, bringing fresh updates like new starter kits to kickstart your development journey. If you’re eager to explore these kits alongside Laravel Sail—particularly on a Windows setup with WSL2—you’re in the right place. We’ll also tackle whether Sail remains a go-to option or if the classic laravel new
approach might be better suited for you. Let’s dive in!
What’s New in Laravel 12?
Released in early 2025, Laravel 12 introduces starter kits that offer pre-built scaffolding for common tasks like authentication and frontend setups. For example, the Livewire Starter Kit lets you craft dynamic, reactive interfaces with ease. These kits save time and ensure consistency, making them a fantastic choice for developers of all levels. So, how do you combine one with Laravel Sail, the Docker-powered development environment included with Laravel?
Setting Up Laravel 12 with Sail and a Starter Kit
Laravel Sail streamlines local development by bundling your app’s dependencies (PHP, MySQL, Redis, etc.) into Docker containers. While Sail doesn’t prompt you to pick a starter kit during setup, you can integrate one into a new Laravel project and then layer Sail on top. Here’s a clear, community-inspired workflow:
- Install the Laravel Installer: If it’s not already installed, grab the Laravel installer globally via Composer. In your WSL2 terminal, run:
composer global require laravel/installer
- Create a New Laravel Project: Scaffold a fresh Laravel 12 app with:
laravel new my-app
You might be prompted to select a starter kit (like Livewire) here. If not, it’ll still work seamlessly with Sail. - Navigate to Your Project: Switch to your new app’s directory:
cd my-app
- Install Sail: Laravel 12 bundles Sail as a dev dependency in
composer.json
. Set it up by running:
php artisan sail:install
This generates adocker-compose.yml
file and tweaks your.env
file for Docker. You’ll choose services (e.g., MySQL, Redis) during this step. - Start Sail: Fire up your containers with:
./vendor/bin/sail up
Your app will be live athttp://localhost
. For convenience in WSL2, add an alias likealias sail='./vendor/bin/sail'
to your~/.bashrc
.
That’s it! You’ve got Laravel 12 running with Sail and your starter kit, ready to roll on WSL2.
Is Sail Still the Best Choice?
You might wonder if Sail is still recommended or if laravel new
without Docker is the way to go. It depends on your project. Sail excels in multi-platform setups, delivering a consistent, reproducible environment—great for teams or complex workflows (think Laravel backend with a Nuxt frontend in a monorepo). It spares you the headache of managing local PHP or database versions, which is a boon on WSL2.
That said, Sail’s default setup can feel hefty for smaller projects. If you lean toward lightweight options, tools like Laragon (on Windows) or a simple laravel new
with a local stack might appeal more. The downside? You lose Sail’s containerized portability. One developer praised Sail for “making monorepo development easier,” while another highlighted that “Laragon works just fine” for simpler needs.
Final Thoughts
Combining Laravel 12’s starter kits with Sail delivers a robust, modern development setup. Whether you’re using Livewire or another kit, the process is smooth once you grasp the steps. Sail remains a strong pick for Docker fans or anyone valuing consistency across environments, though lighter alternatives have their place. Give it a spin—scaffold a new project today and discover how Laravel 12 and Sail can power your next creation!
Comentários Recentes