- Use PHP 8.3+ and leverage its latest features (readonly properties, enums, typed constants, etc.).
- Follow code style conventions defined in
pint.jsonor equivalent (PHP-CS-Fixer). - Enable strict types (
declare(strict_types=1);) in all PHP files. - Define explicit types for arrays and enforce them using PHPStan (
array shapesor dedicated DTOs). - No business logic should live in controllers or route files — respect separation of concerns.
- Avoid using static facades like
DB::; prefer clean service injection orModel::query()style logic.
- Create folders only when needed
- Remove
.gitkeeponce files are added - Use consistent naming conventions
- Make services testable and loosely coupled
- Follow SOLID, DRY, YAGNI
| Directory | Purpose |
|---|---|
src/Http/Controllers |
Controllers, lightweight, no business logic |
src/Http/Requests |
Request validation objects |
src/Actions |
Domain-specific use cases, named using CreateX, UpdateX, etc. |
src/Models |
Business models or Eloquent models if using Laravel (no fillable) |
src/DTO/ |
Strongly typed data transfer objects |
src/Services/ |
Application-level services or third-party integrations |
database/migrations |
Schema migrations, omit down() method entirely |
💡 If using Laravel: do not use abstract
Controller.phpbase classes. Prefer clarity and modularity.
- Use Pest PHP
- Cover business logic with tests
- Organize by functionality
| Test Folder | Purpose |
|---|---|
tests/Feature/Http |
Feature tests for controllers |
tests/Feature/Console |
CLI command tests |
tests/Unit/Actions |
Unit tests for business actions |
tests/Unit/Models |
Unit tests for models |
tests/Unit/Services |
Unit tests for service classes |
tests/Unit/DTO |
Unit tests for data structures |
✔️ Run
composer lintafter editing or creating files
✔️ Runcomposer testbefore submitting any code
❌ Do not delete any test without explicit approval
- Use TailwindCSS for all styles.
- Keep all user interfaces clean, minimal, and purpose-driven.
- Avoid legacy frontend libraries (e.g., jQuery, Bootstrap).
- For interactivity, use AlpineJS or React, depending on the stack.
- When making frontend-related changes, rebuild assets (
npm run build,vite build, etc.). - Do not add, remove, or update dependencies in
composer.jsonorpackage.jsonwithout prior approval. - Ensure the following before marking a task as complete:
- ✅ Code follows all defined conventions
- ✅ All tests pass (
composer test) - ✅ Code is clean per linters (
composer lint) - ✅ No errors or warnings in static analysis (PHPStan)
- ✅ Assets are compiled
Commits must follow the Conventional Commits specification. It's a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.
The commit message should be structured as follows:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
The commit contains the following structural elements, to communicate intent to the consumers of your library:
- fix: a commit of the type
fixpatches a bug in your codebase (this correlates withPATCHin Semantic Versioning). - feat: a commit of the type
featintroduces a new feature to the codebase (this correlates withMINORin Semantic Versioning). - BREAKING CHANGE: a commit that has a footer
BREAKING CHANGE:, or appends a!after the type/scope, introduces a breaking API change (correlating withMAJORin Semantic Versioning). A BREAKING CHANGE can be part of commits of any type. - types other than
fix:andfeat:are allowed, for example @commitlint/config-conventional (based on the Angular convention) recommendsbuild:,chore:,ci:,docs:,style:,refactor:,perf:,test:, and others. - footers other than
BREAKING CHANGE: <description>may be provided and follow a convention similar to git trailer format.
- Use service containers for DI
- Prefer Value Objects/DTOs over arrays
- Use PHPStan/Psalm for static analysis
- Use Rector for modernization
- Add PHPDoc for IDE support