32 lines
655 B
Markdown
32 lines
655 B
Markdown
---
|
|
trigger: always_on
|
|
---
|
|
|
|
# Rule: Running PHP Artisan Commands
|
|
|
|
## ❗ Important
|
|
|
|
Never execute `php artisan` commands directly on the host machine.
|
|
|
|
## ✅ Correct Approach
|
|
|
|
All Artisan commands **must be executed inside the Docker container**.
|
|
|
|
## 📦 Reason
|
|
|
|
The application environment (PHP version, extensions, dependencies) is fully configured inside the container. Running commands outside may cause:
|
|
|
|
- Version mismatches
|
|
- Missing dependencies
|
|
- Inconsistent behavior
|
|
|
|
## 🛠️ How to Execute
|
|
|
|
Use one of the following patterns depending on the setup:
|
|
|
|
### Docker Compose
|
|
|
|
```bash
|
|
docker compose exec <app_service> php artisan <command>
|
|
```
|