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.
94 lines
2.2 KiB
94 lines
2.2 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**.
|
|
|
|
---
|
|
---
|
|
|
|
## 🛠 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
|
|
|
|
```bash
|
|
git clone
|
|
cd project
|
|
```
|
|
### 2. Create the .env file
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
### 📄 Example `.env` Configuration
|
|
|
|
```env
|
|
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
|
|
```bash
|
|
docker-compose up -d --build
|
|
```
|
|
### 4. Run composer to install package and NPM
|
|
```bash
|
|
composer install --ignore-platform-reqs
|
|
npm install
|
|
```
|
|
### 5. Generate application key
|
|
```bash
|
|
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
|
|
```bash
|
|
php artisan passport:client --password
|
|
```
|
|
### 2. Get an Access Token via API
|
|
|
|
Endpoint:
|
|
```bash
|
|
POST http://<url_local>:<port>/oauth/token
|
|
```
|
|
Headers:
|
|
```bash
|
|
Accept: application/json
|
|
Content-Type: application/x-www-form-urlencoded
|
|
```
|
|
Body:
|
|
```bash
|
|
grant_type=password
|
|
client_id=YOUR_CLIENT_ID
|
|
client_secret=YOUR_CLIENT_SECRET
|
|
username=test@example.com
|
|
password=secret123
|
|
scope=
|
|
```
|
|
✅ Successful Response
|
|
|
|
```json
|
|
{
|
|
"token_type": "Bearer",
|
|
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
|
|
"expires_in": 3600
|
|
}
|
|
```
|
|
|