You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.4 KiB
2.4 KiB
Laravel 12 - Content Management Project (Dockerized)
This project is a content management system (CMS) built with Laravel 12, running in a development environment powered by Docker + Docker Compose It integrates modern Laravel tools including:
- Livewire – For building reactive components using Blade.
- Passport – Provides API authentication using OAuth2.
- Vite – Bundles and hot-reloads frontend assets efficiently.
🛠 Requirements
Component | Description |
---|---|
Laravel 12 | Primary PHP framework using MVC architecture |
PHP 8.4 (FPM) | Latest version of PHP with high performance |
MySQL 8 | Relational database management system |
Nginx | Lightweight and fast web server for handling HTTP requests |
Docker | Isolated and portable containerized environment |
Docker Compose | Manage multiple containerized services in one configuration |
Composer | PHP dependency manager |
🚀 Install
1. Clone the project
git clone
cd project
2. Create the .env file
cp .env.example .env
📄 Example .env
Configuration
APP_URL=http://localhost:8080
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=secret
SESSION_DRIVER=database
3. Build and start Docker containers
docker-compose up -d --build
4. Run composer to install package and NPM
composer install --ignore-platform-reqs
npm install
5. Generate application key
php artisan key:generate
🔐 API Authentication with Laravel Passport
Laravel Passport provides a complete OAuth2 authentication system for your Laravel APIs. Below are the steps to install and configure Passport for this Laravel 12 (Dockerized) project.
1. Create a Password Grant Client
php artisan passport:client --password
2. Get an Access Token via API
Endpoint:
POST http://<url_local>:<port>/oauth/token
Headers:
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Body:
grant_type=password
client_id=YOUR_CLIENT_ID
client_secret=YOUR_CLIENT_SECRET
username=test@example.com
password=secret123
scope=
✅ Successful Response
{
"token_type": "Bearer",
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
"expires_in": 3600
}