Laravel BasicsCore· 35 min read

Setting Up Laravel (Composer & Artisan)

Create a Laravel project and meet artisan — the command-line assistant you’ll use daily.

What you will learn

  • Install with Composer
  • Run the dev server
  • Use artisan commands

Create a project

Laravel uses Composer (PHP’s package manager, like npm for PHP). Create a new app, then start it.

Terminal: create and run a Laravel app
# install Composer first (getcomposer.org), then:
composer create-project laravel/laravel myapp

cd myapp
php artisan serve
# open http://localhost:8000

Let us read those four lines: composer create-project laravel/laravel myapp downloads a fresh Laravel app into a new folder called myapp. cd myapp moves into that folder. php artisan serve starts a small built-in web server so you can see your app. The last line is just a comment reminding you which address to open.

Note: Output: INFO Server running on [http://127.0.0.1:8000]. Leave this terminal running and open http://localhost:8000 in your browser — you will see Laravel’s welcome page. Press Ctrl+C to stop the server.

Artisan — your assistant

php artisan is Laravel’s command-line tool. It generates code, runs migrations, clears caches and more.

Common artisan commands
php artisan make:controller ProductController
php artisan make:model Product -m       # model + migration
php artisan migrate                      # run database migrations
php artisan route:list                   # see all routes

Each line asks artisan to do one job for you: make:controller creates a new controller file, make:model Product -m creates a model and its migration (the -m flag means "with migration"), migrate builds your tables in the database, and route:list prints every route in your app so you can check your URLs. You type these in the terminal, not in a browser.

Note: Key folders: routes/web.php (routes), app/Http/Controllers (controllers), app/Models (models), resources/views (Blade templates), database/migrations (table definitions).

Q. What is "artisan" in Laravel?

Answer: php artisan is Laravel’s CLI — it scaffolds controllers/models, runs migrations, lists routes and much more.

✍️ Practice

  1. Create a Laravel project and run php artisan serve.
  2. Use artisan to generate a controller and a model.

🏠 Homework

  1. Explore the project folders and note what each key folder holds.
Want to learn this with a mentor?

CodingClave runs guided, project-based training (28-day, 45-day & 6-month batches).

Explore Training →