You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[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)
15
15
-[IDE Support](#ide-support)
16
16
-[Next Steps](#next-steps)
17
17
-[Laravel The Full Stack Framework](#laravel-the-fullstack-framework)
@@ -50,52 +50,94 @@ Need extreme scaling? Platforms like [Laravel Vapor](https://vapor.laravel.com)
50
50
51
51
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.
52
52
53
-
<aname="your-first-laravel-project"></a>
54
-
## Your First Laravel Project
53
+
<aname="creating-a-laravel-project"></a>
54
+
## Creating A Laravel Project
55
55
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).
57
57
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:
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:
73
65
74
66
```nothing
75
67
cd example-app
76
68
77
69
php artisan serve
78
70
```
79
71
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).
81
73
82
74
> **Note**
83
75
> 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.
84
76
85
-
<aname="laravel-and-docker"></a>
86
-
## Laravel & Docker
77
+
<aname="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
+
<aname="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
+
<aname="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
+
<aname="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
+
<aname="docker-installation-using-sail"></a>
128
+
## Docker Installation Using Sail
87
129
88
130
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).
89
131
90
132
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).
91
133
92
134
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.
93
135
94
-
> **Note**
136
+
> **Note**
95
137
> Already a Docker expert? Don't worry! Everything about Sail can be customized using the `docker-compose.yml` file included with Laravel.
96
138
97
-
<aname="getting-started-on-macos"></a>
98
-
### Getting Started On macOS
139
+
<aname="sail-on-macos"></a>
140
+
### Sail On macOS
99
141
100
142
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:
101
143
@@ -117,15 +159,15 @@ cd example-app
117
159
118
160
Once the application's Docker containers have been started, you can access the application in your web browser at: http://localhost.
119
161
120
-
> **Note**
162
+
> **Note**
121
163
> To continue learning more about Laravel Sail, review its [complete documentation](/docs/{{version}}/sail).
122
164
123
-
<aname="getting-started-on-windows"></a>
124
-
### Getting Started On Windows
165
+
<aname="sail-on-windows"></a>
166
+
### Sail On Windows
125
167
126
168
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).
127
169
128
-
> **Note**
170
+
> **Note**
129
171
> 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/).
130
172
131
173
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
148
190
149
191
Once the application's Docker containers have been started, you can access the application in your web browser at: http://localhost.
150
192
151
-
> **Note**
193
+
> **Note**
152
194
> To continue learning more about Laravel Sail, review its [complete documentation](/docs/{{version}}/sail).
153
195
154
196
#### Developing Within WSL2
@@ -157,8 +199,8 @@ Of course, you will need to be able to modify the Laravel application files that
157
199
158
200
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.
159
201
160
-
<aname="getting-started-on-linux"></a>
161
-
### Getting Started On Linux
202
+
<aname="sail-on-linux"></a>
203
+
### Sail On Linux
162
204
163
205
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.
164
206
@@ -188,7 +230,7 @@ cd example-app
188
230
189
231
Once the application's Docker containers have been started, you can access the application in your web browser at: http://localhost.
190
232
191
-
> **Note**
233
+
> **Note**
192
234
> To continue learning more about Laravel Sail, review its [complete documentation](/docs/{{version}}/sail).
193
235
194
236
<aname="choosing-your-sail-services"></a>
@@ -208,53 +250,6 @@ You may instruct Sail to install a default [Devcontainer](/docs/{{version}}/sail
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
-
<aname="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
-
<aname="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
-
<aname="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.
0 commit comments