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:
composer create-project laravel/laravel task-manager
cd task-manager
cp .env.example .env
php artisan key:generateCode
Inspect the core dependency definitions inside composer.json:
{
"name": "thecodehub/task-manager",
"type": "project",
"require": {
"php": "^8.4",
"laravel/framework": "^13.0"
}
}Explanation
APP_KEYin.envis a 32-character random string used by Laravel's encrypter for session hashes and encrypted cookies.- Running
php artisan key:generatesets this key automatically.
Common Mistakes
- Committing `.env` to version control: Never commit
.envcontaining 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.