Skip to content

Commit 8cf7318

Browse files
committed
update installation docs
1 parent 480c553 commit 8cf7318

File tree

1 file changed

+75
-80
lines changed

1 file changed

+75
-80
lines changed

installation.md

Lines changed: 75 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
- [Meet Laravel](#meet-laravel)
44
- [Why Laravel?](#why-laravel)
5-
- [Your First Laravel Project](#your-first-laravel-project)
6-
- [Laravel & Docker](#laravel-and-docker)
7-
- [Getting Started On macOS](#getting-started-on-macos)
8-
- [Getting Started On Windows](#getting-started-on-windows)
9-
- [Getting Started On Linux](#getting-started-on-linux)
10-
- [Choosing Your Sail Services](#choosing-your-sail-services)
5+
- [Creating A Laravel Project](#creating-a-laravel-project)
116
- [Initial Configuration](#initial-configuration)
127
- [Environment Based Configuration](#environment-based-configuration)
138
- [Databases & Migrations](#databases-and-migrations)
149
- [Directory Configuration](#directory-configuration)
10+
- [Docker Installation Using Sail](#docker-installation-using-sail)
11+
- [Sail On macOS](#sail-on-macos)
12+
- [Sail On Windows](#sail-on-windows)
13+
- [Sail On Linux](#sail-on-linux)
14+
- [Choosing Your Sail Services](#choosing-your-sail-services)
1515
- [IDE Support](#ide-support)
1616
- [Next Steps](#next-steps)
1717
- [Laravel The Full Stack Framework](#laravel-the-fullstack-framework)
@@ -50,52 +50,94 @@ Need extreme scaling? Platforms like [Laravel Vapor](https://vapor.laravel.com)
5050

5151
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](https://github.com/laravel/framework). Who knows, maybe you'll even become a Laravel contributor.
5252

53-
<a name="your-first-laravel-project"></a>
54-
## Your First Laravel Project
53+
<a name="creating-a-laravel-project"></a>
54+
## Creating A Laravel Project
5555

56-
Before creating your first Laravel project, you should ensure that your local machine has PHP and [Composer](https://getcomposer.org) installed. If you are developing on macOS, PHP and Composer can be installed within minutes via [Laravel Herd](https://herd.laravel.com). In addition, we recommend [installing Node and NPM](https://nodejs.org).
56+
Before creating your first Laravel project, make sure that your local machine has PHP and [Composer](https://getcomposer.org) installed. If you are developing on macOS, PHP and Composer can be installed within minutes via [Laravel Herd](https://herd.laravel.com). In addition, we recommend [installing Node and NPM](https://nodejs.org).
5757

58-
After you have installed PHP and Composer, you may create a new Laravel project via the Composer `create-project` command:
58+
After you have installed PHP and Composer, you may create a new Laravel project via Composer's `create-project` command:
5959

6060
```nothing
6161
composer create-project laravel/laravel example-app
6262
```
6363

64-
Or, you may create new Laravel projects by globally installing the Laravel installer via Composer. Or, if you installed PHP and Composer via [Laravel Herd](https://herd.laravel.com), the Laravel installer is already available to you:
65-
66-
```nothing
67-
composer global require laravel/installer
68-
69-
laravel new example-app
70-
```
71-
72-
After the project has been created, start Laravel's local development server using the Laravel's Artisan CLI `serve` command:
64+
Once the project has been created, start Laravel's local development server using Laravel Artisan's `serve` command:
7365

7466
```nothing
7567
cd example-app
7668
7769
php artisan serve
7870
```
7971

80-
Once you have started the Artisan 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](#next-steps). Of course, you may also want to [configure a database](#databases-and-migrations).
72+
Once you have started the Artisan development server, your application will be accessible in your web browser at [http://localhost:8000](http://localhost:8000). Next, you're ready to [start taking your next steps into the Laravel ecosystem](#next-steps). Of course, you may also want to [configure a database](#databases-and-migrations).
8173

8274
> **Note**
8375
> If you would like a head start when developing your Laravel application, consider using one of our [starter kits](/docs/{{version}}/starter-kits). Laravel's starter kits provide backend and frontend authentication scaffolding for your new Laravel application.
8476
85-
<a name="laravel-and-docker"></a>
86-
## Laravel & Docker
77+
<a name="initial-configuration"></a>
78+
## Initial Configuration
79+
80+
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.
81+
82+
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.
83+
84+
<a name="environment-based-configuration"></a>
85+
### Environment Based Configuration
86+
87+
Since many of Laravel's configuration option values may vary depending on whether your application is running on your local machine or on a production web server, many important configuration values are defined using the `.env` file that exists at the root of your application.
88+
89+
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 get exposed.
90+
91+
> **Note**
92+
> For more information about the `.env` file and environment based configuration, check out the full [configuration documentation](/docs/{{version}}/configuration#environment-configuration).
93+
94+
<a name="databases-and-migrations"></a>
95+
### Databases & Migrations
96+
97+
Now that you have created your Laravel application, you probably want to store some data in a database. By default, your application's `.env` configuration file specifies that Laravel will be interacting with a MySQL database and will access the database at `127.0.0.1`.
98+
99+
> **Note**
100+
> If you are developing on macOS and need to install MySQL, Postgres, or Redis locally, consider using [DBngin](https://dbngin.com/).
101+
102+
If you do not want to install MySQL or Postgres on your local machine, you can always use a [SQLite](https://www.sqlite.org/index.html) database. SQLite is a small, fast, self-contained database engine. To get started, update your `.env` configuration file to use Laravel's `sqlite` database driver. You may remove the other database configuration options:
103+
104+
```ini
105+
DB_CONNECTION=sqlite # [tl! add]
106+
DB_CONNECTION=mysql # [tl! remove]
107+
DB_HOST=127.0.0.1 # [tl! remove]
108+
DB_PORT=3306 # [tl! remove]
109+
DB_DATABASE=laravel # [tl! remove]
110+
DB_USERNAME=root # [tl! remove]
111+
DB_PASSWORD= # [tl! remove]
112+
```
113+
114+
Once you have configured your SQLite database, you may run your application's [database migrations](/docs/{{version}}/migrations), which will create your application's database tables:
115+
116+
```shell
117+
php artisan migrate
118+
```
119+
120+
If an SQLite database does not exist for your application, Laravel will ask you if you would like the database to be created. Typically, the SQLite database file will be created at `database/database.sqlite`.
121+
122+
<a name="directory-configuration"></a>
123+
### Directory Configuration
124+
125+
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.
126+
127+
<a name="docker-installation-using-sail"></a>
128+
## Docker Installation Using Sail
87129

88130
We want it to be as easy as possible to get started with Laravel regardless of your preferred operating system. So, there are a variety of options for developing and running a Laravel project on your local machine. While you may wish to explore these options at a later time, Laravel provides [Sail](/docs/{{version}}/sail), a built-in solution for running your Laravel project using [Docker](https://www.docker.com).
89131

90132
Docker is a tool for running applications and services in small, light-weight "containers" which do not interfere with your local machine's installed software or configuration. This means you don't have to worry about configuring or setting up complicated development tools such as web servers and databases on your local machine. To get started, you only need to install [Docker Desktop](https://www.docker.com/products/docker-desktop).
91133

92134
Laravel Sail is a light-weight command-line interface for interacting with Laravel's default Docker configuration. Sail provides a great starting point for building a Laravel application using PHP, MySQL, and Redis without requiring prior Docker experience.
93135

94-
> **Note**
136+
> **Note**
95137
> Already a Docker expert? Don't worry! Everything about Sail can be customized using the `docker-compose.yml` file included with Laravel.
96138
97-
<a name="getting-started-on-macos"></a>
98-
### Getting Started On macOS
139+
<a name="sail-on-macos"></a>
140+
### Sail On macOS
99141

100142
If you're developing on a Mac and [Docker Desktop](https://www.docker.com/products/docker-desktop) is already installed, you can use a simple terminal command to create a new Laravel project. For example, to create a new Laravel application in a directory named "example-app", you may run the following command in your terminal:
101143

@@ -117,15 +159,15 @@ cd example-app
117159

118160
Once the application's Docker containers have been started, you can access the application in your web browser at: http://localhost.
119161

120-
> **Note**
162+
> **Note**
121163
> To continue learning more about Laravel Sail, review its [complete documentation](/docs/{{version}}/sail).
122164
123-
<a name="getting-started-on-windows"></a>
124-
### Getting Started On Windows
165+
<a name="sail-on-windows"></a>
166+
### Sail On Windows
125167

126168
Before we create a new Laravel application on your Windows machine, make sure to install [Docker Desktop](https://www.docker.com/products/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://docs.microsoft.com/en-us/windows/wsl/install-win10).
127169

128-
> **Note**
170+
> **Note**
129171
> After installing and enabling WSL2, you should ensure that Docker Desktop is [configured to use the WSL2 backend](https://docs.docker.com/docker-for-windows/wsl/).
130172
131173
Next, you are ready to create your first Laravel project. Launch [Windows Terminal](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701?rtc=1&activetab=pivot:overviewtab) 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 project. For example, to create a new Laravel application in a directory named "example-app", you may run the following command in your terminal:
@@ -148,7 +190,7 @@ cd example-app
148190

149191
Once the application's Docker containers have been started, you can access the application in your web browser at: http://localhost.
150192

151-
> **Note**
193+
> **Note**
152194
> To continue learning more about Laravel Sail, review its [complete documentation](/docs/{{version}}/sail).
153195
154196
#### Developing Within WSL2
@@ -157,8 +199,8 @@ Of course, you will need to be able to modify the Laravel application files that
157199

158200
Once these tools are installed, you may open any Laravel project by executing the `code .` command from your application's root directory using Windows Terminal.
159201

160-
<a name="getting-started-on-linux"></a>
161-
### Getting Started On Linux
202+
<a name="sail-on-linux"></a>
203+
### Sail On Linux
162204

163205
If you're developing on Linux and [Docker Compose](https://docs.docker.com/compose/install/) is already installed, you can use a simple terminal command to create a new Laravel project.
164206

@@ -188,7 +230,7 @@ cd example-app
188230

189231
Once the application's Docker containers have been started, you can access the application in your web browser at: http://localhost.
190232

191-
> **Note**
233+
> **Note**
192234
> To continue learning more about Laravel Sail, review its [complete documentation](/docs/{{version}}/sail).
193235
194236
<a name="choosing-your-sail-services"></a>
@@ -208,53 +250,6 @@ You may instruct Sail to install a default [Devcontainer](/docs/{{version}}/sail
208250
curl -s "https://laravel.build/example-app?with=mysql,redis&devcontainer" | bash
209251
```
210252

211-
<a name="initial-configuration"></a>
212-
## Initial Configuration
213-
214-
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.
215-
216-
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.
217-
218-
<a name="environment-based-configuration"></a>
219-
### Environment Based Configuration
220-
221-
Since many of Laravel's configuration option values may vary depending on whether your application is running on your local machine or on a production web server, many important configuration values are defined using the `.env` file that exists at the root of your application.
222-
223-
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 get exposed.
224-
225-
> **Note**
226-
> For more information about the `.env` file and environment based configuration, check out the full [configuration documentation](/docs/{{version}}/configuration#environment-configuration).
227-
228-
<a name="databases-and-migrations"></a>
229-
### Databases & Migrations
230-
231-
Now that you have created your Laravel application, you probably want to store some data in a database. By default, your application's `.env` configuration file specifies that Laravel will be interacting with a MySQL database and will access the database at `127.0.0.1`. If you are developing on macOS and need to install MySQL, Postgres, or Redis locally, you may find it convenient to utilize [DBngin](https://dbngin.com/).
232-
233-
If you do not want to install MySQL or Postgres on your local machine, you can always use a [SQLite](https://www.sqlite.org/index.html) database. SQLite is a small, fast, self-contained database engine. To get started, update your `.env` configuration file to use Laravel's `sqlite` database driver. You may remove the other database configuration options:
234-
235-
```ini
236-
DB_CONNECTION=sqlite # [tl! add]
237-
DB_CONNECTION=mysql # [tl! remove]
238-
DB_HOST=127.0.0.1 # [tl! remove]
239-
DB_PORT=3306 # [tl! remove]
240-
DB_DATABASE=laravel # [tl! remove]
241-
DB_USERNAME=root # [tl! remove]
242-
DB_PASSWORD= # [tl! remove]
243-
```
244-
245-
Once you have configured your SQLite database, you may run your application's [database migrations](/docs/{{version}}/migrations), which will create your application's database tables:
246-
247-
```shell
248-
php artisan migrate
249-
```
250-
251-
If an SQLite database does not exist for your application, Laravel will ask you if you would like the database to be created. Typically, the SQLite database file will be created at `database/database.sqlite`.
252-
253-
<a name="directory-configuration"></a>
254-
### Directory Configuration
255-
256-
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.
257-
258253
<a name="ide-support"></a>
259254
## IDE Support
260255

0 commit comments

Comments
 (0)