🎓 A1Learner
🔍
0 of 50 lessons completed

Laravel Deployment

Deployment means putting your app on a server so others can use it. The server runs the same code you ran on your own machine.

Caching the config

The command prints one line when the cache is ready.

php artisan config:cache

Starting the server

The server prints the address it listens on.

php artisan serve --port=8132

Checking the live page

curl asks the running server for a page.

curl http://127.0.0.1:8132/l49/status

Example

php artisan serve --port=8132
curl http://127.0.0.1:8132/l49/status

Key points

  • Deployment: putting your app on a server for others to use.
  • Use php artisan serve to run the app on your own machine.
  • Use config:cache to store the config files in one fast file.
  • Use php artisan --version to check the Laravel version on the server.

In this example, serve starts the app on port 8132. Run it in one terminal, then run curl in a second terminal. curl asks the server for the status page. The server answers with the page text. Deployment means putting your app on a server so others can use it.

Note

A cached config ignores later edits to the env file, so clear it after a change.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

What does php artisan config:cache do?