Before you start, ensure that you have PHP and Composer installed on your local machine. If you’re developing on macOS, you can easily install PHP and Composer using Laravel Herd. Additionally, it’s recommended to have Node.js and NPM installed for frontend development.
You have two options for creating a new Laravel project: using Composer directly or using the Laravel installer.
a. Using Composer:
b. Using Laravel installer (if globally installed):
Navigate to the project directory:
Start Laravel’s local development server:
Now, you can access your Laravel application in your web browser at http://localhost:8000.
Using Laravel Sail
Creating a New Laravel Project with Sail
Run the following command to create a new Laravel project using Sail:
Navigate to the project directory:
Start Laravel Sail (Docker containers for development):
Access your application in a web browser at http://localhost.
Before you begin, make sure to have Docker Desktop installed on your Windows machine. Also, install Windows Subsystem for Linux 2 (WSL2) and configure Docker to use it.
Creating a New Laravel Project with Sail on WSL2
Run the following command in Windows Terminal to create a new Laravel project using Sail:
Navigate to the project directory within WSL2:
Start Laravel Sail:
Access your application in a web browser at http://localhost.
Before you start, ensure that Docker Compose is installed on your Linux machine.
Creating a New Laravel Project with Sail
If you’re using Docker Desktop for Linux, set the Docker context:
Run the following command to create a new Laravel project using Sail:
Navigate to the project directory:
Start Laravel Sail:
Access your application in a web browser at http://localhost.
Choosing Sail Services
You can customize the services in your Laravel Sail setup using the following command:
Initial Configuration
Feel free to explore the (“config /app .php”) file for various configuration options you can modify.
Databases & Migrations
If you want to use SQLite as your database driver:
Run database migrations:
Next Steps
You’re now ready to dive deeper into the Laravel ecosystem. Check out Laravel’s documentation to learn more about features and best practices. Whether you’re building a full-stack application or an API backend, Laravel provides extensive tools and resources to streamline your development process. Happy coding!
Acepto los términos y condiciones...