Laravel Creating a First App
A Laravel app is a folder with code and settings for one website. Composer creates the folder, and Artisan serves it for testing.
Create the app
This command builds a new Laravel app named my-app.
composer create-project laravel/laravel my-appStart the server
Move into the app folder, then start the test server.
cd my-app
php artisan serveCheck the page
Ask the server for the home page and show only the status code.
curl -s -o /dev/null -w "HTTP %{http_code}" http://127.0.0.1:8000/Example
composer create-project laravel/laravel my-app
cd my-app
php artisan serveKey points
- Laravel app: a folder with code and settings for one website.
- create-project: a Composer command that builds a new Laravel app.
- The .env file holds settings for one app, like its name.
- env file: a settings file named .env in the app folder.
- The welcome page proves the new app works.
In this example, the app is created and started. The first line builds a new Laravel app named my-app. The second line moves into the app folder. The third line starts the test server, and the welcome page then answers with HTTP 200.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
Which command creates a new Laravel app?