Creating the Project
Module 1 — Laravel FundamentalsArticleFree Preview15 min read

Creating the Project

Goal

Create a brand new Laravel application instance and run the local development server.

Why It Matters

Standardized project initialization sets up dependency locking, environment files, and initial database configurations in a reproducible manner.

Concept

composer create-project downloads the standard Laravel application skeleton and initializes all direct and transitive dependencies defined in composer.json.

Build

Initialize our Task Management application in your local workspace:

Bash
composer create-project laravel/laravel task-manager
cd task-manager
cp .env.example .env
php artisan key:generate

Code

Inspect the core dependency definitions inside composer.json:

JSON
{
    "name": "thecodehub/task-manager",
    "type": "project",
    "require": {
        "php": "^8.4",
        "laravel/framework": "^13.0"
    }
}

Explanation

  • APP_KEY in .env is a 32-character random string used by Laravel's encrypter for session hashes and encrypted cookies.
  • Running php artisan key:generate sets this key automatically.

Common Mistakes

  • Committing `.env` to version control: Never commit .env containing production database passwords or application keys. Only commit .env.example.

Task

Initialize the task-manager project, generate the application key, and start the local development server via php artisan serve.

Checkpoint

Open http://localhost:8000 in your browser and confirm the Laravel welcome page renders successfully.

Next

Now that the server is responding, we will tour the directory structure of the application.

Implementation Tasks

0 / 1 Done

Initialize task-manager application and verify development server

Generate APP_KEY, configure local .env, and verify HTTP status 200 on port 8000.

Previous: What Laravel Is