Installation - Laravel 11.x - The PHP Framework For Web Artisans
Installation - Laravel 11.x - The PHP Framework For Web Artisans
Join the waitlist for Laravel Nightwatch, first-class monitoring designed for Laravel.
VERSION
Search 11.x
Installation
# Meet Laravel
# Why Laravel?
# Creating an Application
# Initial Configuration
# Directory Configuration
# Herd on macOS
# Herd on Windows
# Sail on macOS
# Sail on Windows
# Sail on Linux
https://laravel.com/docs/11.x#installing-php 1/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
# IDE Support
# Next Steps
# Meet Laravel
Laravel is a web application framework with expressive, elegant syntax. A web
framework provides a structure and starting point for creating your application,
allowing you to focus on creating something amazing while we sweat the details.
Whether you are new to PHP web frameworks or have years of experience, Laravel
is a framework that can grow with you. We'll help you take your first steps as a web
developer or give you a boost as you take your expertise to the next level. We can't
wait to see what you build.
https://laravel.com/docs/11.x#installing-php 2/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
# Why Laravel?
There are a variety of tools and frameworks available to you when building a web
application. However, we believe Laravel is the best choice for building modern,
full-stack web applications.
A Progressive Framework
If you're a senior developer, Laravel gives you robust tools for dependency
injection, unit testing, queues, real-time events, and more. Laravel is fine-tuned for
building professional web applications and ready to handle enterprise work loads.
A Scalable Framework
https://laravel.com/docs/11.x#installing-php 3/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
Need extreme scaling? Platforms like Laravel Vapor allow you to run your Laravel
application at nearly limitless scale on AWS's latest serverless technology.
A Community Framework
Laravel combines the best packages in the PHP ecosystem to offer the most robust
and developer friendly framework available. In addition, thousands of talented
developers from around the world have contributed to the framework. Who knows,
maybe you'll even become a Laravel contributor.
Installation If you don't have PHP and Composer installed on your local machine, the following
commands will install PHP, Composer, and the Laravel installer on macOS,
Configuration
Windows, or Linux:
Directory Structure
Starter Kits
# Run as administrator...
Deployment
https://laravel.com/docs/11.x#installing-php 4/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
The Basics
Digging Deeper After running one of the commands above, you should restart your terminal
session. To update PHP, Composer, and the Laravel installer after installing them
Security
via php.new , you can re-run the command in your terminal.
Database
If you already have PHP and Composer installed, you may install the Laravel
Eloquent ORM
installer via Composer:
Testing
API Documentation
Laravel Nova: The next generation For a fully-featured, graphical PHP installation and management
of Nova is now available. experience, check out Laravel Herd.
# Creating an Application
After you have installed PHP, Composer, and the Laravel installer, you're ready to
create a new Laravel application. The Laravel installer will prompt you to select
your preferred testing framework, database, and starter kit:
https://laravel.com/docs/11.x#installing-php 5/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
Once the application has been created, you can start Laravel's local development
server, queue worker, and Vite development server using the dev Composer script:
cd example-app
npm install && npm run build
composer run dev
Once you have started the development server, your application will be accessible
in your web browser at http://localhost:8000. Next, you're ready to start taking
your next steps into the Laravel ecosystem. Of course, you may also want to
configure a database.
# Initial Configuration
All of the configuration files for the Laravel framework are stored in the config
directory. Each option is documented, so feel free to look through the files and get
familiar with the options available to you.
https://laravel.com/docs/11.x#installing-php 6/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
Laravel needs almost no additional configuration out of the box. You are free to
get started developing! However, you may wish to review the config/app.php file
and its documentation. It contains several options such as timezone and locale
that you may wish to change according to your application.
Your .env file should not be committed to your application's source control, since
each developer / server using your application could require a different
environment configuration. Furthermore, this would be a security risk in the event
an intruder gains access to your source control repository, since any sensitive
credentials would be exposed.
For more information about the .env file and environment based
configuration, check out the full configuration documentation.
https://laravel.com/docs/11.x#installing-php 7/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
If you prefer to use another database driver such as MySQL or PostgreSQL, you can
update your .env configuration file to use the appropriate database. For example,
if you wish to use MySQL, update your .env configuration file's DB_* variables like
so:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
If you choose to use a database other than SQLite, you will need to create the
database and run your application's database migrations:
https://laravel.com/docs/11.x#installing-php 8/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
# Directory Configuration
Laravel should always be served out of the root of the "web directory" configured
for your web server. You should not attempt to serve a Laravel application out of a
subdirectory of the "web directory". Attempting to do so could expose sensitive
files present within your application.
Once you install Herd, you're ready to start developing with Laravel. Herd includes
command line tools for php , composer , laravel , expose , node , npm , and nvm .
https://laravel.com/docs/11.x#installing-php 9/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
# Herd on macOS
If you develop on macOS, you can download the Herd installer from the Herd
website. The installer automatically downloads the latest version of PHP and
configures your Mac to always run Nginx in the background.
Herd for macOS uses dnsmasq to support "parked" directories. Any Laravel
application in a parked directory will automatically be served by Herd. By default,
Herd creates a parked directory at ~/Herd and you can access any Laravel
application in this directory on the .test domain using its directory name.
After installing Herd, the fastest way to create a new Laravel application is using
the Laravel CLI, which is bundled with Herd:
cd ~/Herd
laravel new my-app
cd my-app
herd open
https://laravel.com/docs/11.x#installing-php 10/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
Of course, you can always manage your parked directories and other PHP settings
via Herd's UI, which can be opened from the Herd menu in your system tray.
You can learn more about Herd by checking out the Herd documentation.
# Herd on Windows
You can download the Windows installer for Herd on the Herd website. After the
installation finishes, you can start Herd to complete the onboarding process and
access the Herd UI for the first time.
After installing Herd, the fastest way to create a new Laravel application is using
the Laravel CLI, which is bundled with Herd. To get started, open Powershell and
run the following commands:
cd ~\Herd
laravel new my-app
cd my-app
herd open
https://laravel.com/docs/11.x#installing-php 11/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
You can learn more about Herd by checking out the Herd documentation for
Windows.
https://laravel.com/docs/11.x#installing-php 12/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
# Sail on macOS
If you're developing on a Mac and Docker Desktop is already installed, you can use
a simple terminal command to create a new Laravel application. For example, to
create a new Laravel application in a directory named "example-app", you may
run the following command in your terminal:
Of course, you can change "example-app" in this URL to anything you like - just
make sure the application name only contains alpha-numeric characters, dashes,
and underscores. The Laravel application's directory will be created within the
directory you execute the command from.
Sail installation may take several minutes while Sail's application containers are
built on your local machine.
After the application has been created, you can navigate to the application
directory and start Laravel Sail. Laravel Sail provides a simple command-line
interface for interacting with Laravel's default Docker configuration:
https://laravel.com/docs/11.x#installing-php 13/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
cd example-app
./vendor/bin/sail up
Once the application's Docker containers have started, you should run your
application's database migrations:
Finally, you can access the application in your web browser at: http://localhost.
# Sail on Windows
Before we create a new Laravel application on your Windows machine, make sure
to install Docker Desktop. Next, you should ensure that Windows Subsystem for
Linux 2 (WSL2) is installed and enabled. WSL allows you to run Linux binary
executables natively on Windows 10. Information on how to install and enable
WSL2 can be found within Microsoft's developer environment documentation.
https://laravel.com/docs/11.x#installing-php 14/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
Next, you are ready to create your first Laravel application. Launch Windows
Terminal and begin a new terminal session for your WSL2 Linux operating system.
Next, you can use a simple terminal command to create a new Laravel
application. For example, to create a new Laravel application in a directory
named "example-app", you may run the following command in your terminal:
Of course, you can change "example-app" in this URL to anything you like - just
make sure the application name only contains alpha-numeric characters, dashes,
and underscores. The Laravel application's directory will be created within the
directory you execute the command from.
Sail installation may take several minutes while Sail's application containers are
built on your local machine.
After the application has been created, you can navigate to the application
directory and start Laravel Sail. Laravel Sail provides a simple command-line
interface for interacting with Laravel's default Docker configuration:
cd example-app
https://laravel.com/docs/11.x#installing-php 15/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
./vendor/bin/sail up
Once the application's Docker containers have started, you should run your
application's database migrations:
Finally, you can access the application in your web browser at: http://localhost.
Of course, you will need to be able to modify the Laravel application files that were
created within your WSL2 installation. To accomplish this, we recommend using
Microsoft's Visual Studio Code editor and their first-party extension for Remote
Development.
Once these tools are installed, you may open any Laravel application by executing
the code . command from your application's root directory using Windows
Terminal.
# Sail on Linux
https://laravel.com/docs/11.x#installing-php 16/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
If you're developing on Linux and Docker Compose is already installed, you can use
a simple terminal command to create a new Laravel application.
First, if you are using Docker Desktop for Linux, you should execute the following
command. If you are not using Docker Desktop for Linux, you may skip this step:
Of course, you can change "example-app" in this URL to anything you like - just
make sure the application name only contains alpha-numeric characters, dashes,
and underscores. The Laravel application's directory will be created within the
directory you execute the command from.
Sail installation may take several minutes while Sail's application containers are
built on your local machine.
After the application has been created, you can navigate to the application
directory and start Laravel Sail. Laravel Sail provides a simple command-line
interface for interacting with Laravel's default Docker configuration:
cd example-app
https://laravel.com/docs/11.x#installing-php 17/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
./vendor/bin/sail up
Once the application's Docker containers have started, you should run your
application's database migrations:
Finally, you can access the application in your web browser at: http://localhost.
mailpit :
https://laravel.com/docs/11.x#installing-php 18/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
If you do not specify which services you would like configured, a default stack of
mysql , redis , meilisearch , mailpit , and selenium will be configured.
You may instruct Sail to install a default Devcontainer by adding the devcontainer
parameter to the URL:
# IDE Support
You are free to use any code editor you wish when developing Laravel applications;
however, PhpStorm offers extensive support for Laravel and its ecosystem,
including Laravel Pint.
# Next Steps
Now that you have created your Laravel application, you may be wondering what
to learn next. First, we strongly recommend becoming familiar with how Laravel
works by reading the following documentation:
Request Lifecycle
https://laravel.com/docs/11.x#installing-php 19/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
Configuration
Directory Structure
Frontend
Service Container
Facades
How you want to use Laravel will also dictate the next steps on your journey. There
are a variety of ways to use Laravel, and we'll explore two primary use cases for the
framework below.
If this is how you plan to use Laravel, you may want to check out our
documentation on frontend development, routing, views, or the Eloquent ORM. In
addition, you might be interested in learning about community packages like
https://laravel.com/docs/11.x#installing-php 20/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
Livewire and Inertia. These packages allow you to use Laravel as a full-stack
framework while enjoying many of the UI benefits provided by single-page
JavaScript applications.
If you are using Laravel as a full stack framework, we also strongly encourage you
to learn how to compile your application's CSS and JavaScript using Vite.
If this is how you plan to use Laravel, you may want to check out our
documentation on routing, Laravel Sanctum, and the Eloquent ORM.
https://laravel.com/docs/11.x#installing-php 21/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
Jump24 Octane
Kirschbaum Pennant
Pint
Prompts
Pulse
Reverb
Sail
https://laravel.com/docs/11.x#installing-php 22/23
01/02/25, 21:01 Installation - Laravel 11.x - The PHP Framework For Web Artisans
Sanctum
Scout
Socialite
Spark
Telescope
Vapor
https://laravel.com/docs/11.x#installing-php 23/23