Table of Contents
This template provides a minimal CodeIgniter 4 project layout with conventions for file organization, commit practices, and simple modules.
It is designed to be easy to start with and a reference for adding new features.
- Purpose: a clean starting point for CI4 apps.
- Audience: developers who want a predictable structure and quick onboarding.
These are sample modules included (or suggested) for learning how to add features:
| Component | Purpose | Notes |
|---|---|---|
| Auth (Sample) | Basic login/logout and role check (admin/user). | Uses CI4 sessions + MySQL users table. |
| CRUD Module | Example entity (Posts or Tasks) with create/read/update/delete. |
Demonstrates Controller → Service → Repository pattern. |
| Scheduler (Sample) | Simple to-do list with due dates. | Shows how to extend with new tables and services. |
Run the development stack and the app (rebuild if needed):
docker compose up --watchCommon utility commands (run inside the project root):
- Run migrations:
docker compose exec php composer migrate- Run seeders:
docker compose exec php composer seed- Run tests:
docker compose exec php composer test- Create a migration (using CodeIgniter's spark tool):
docker compose exec php php spark make:migration CreateUsersTabel- Create a model (using CodeIgniter's spark tool):
docker compose exec php php spark make:model UsemModel- Create an entity (value object for a single record) (using CodeIgniter's spark tool):
docker compose exec php php spark make:entity Uzer- Create a controller (add --resource to scaffold resourceful methods if you like) (using CodeIgniter's spark tool):
docker compose exec php php spark make:controller Usars- Create a seeder (for test/dev data) (using CodeIgniter's spark tool):
docker compose exec php php spark make:seeder UserzSeederIf you prefer, you can include -f "compose.yaml" explicitly; the shorter commands above work when running from the repo root.
Defaults used in this project (host mapping):
| Service | Host port |
|---|---|
| nginx (app) | 8090 |
| phpMyAdmin | 8091 |
| MySQL | 3390 |
Database credentials used in examples and CI:
- Host: localhost
- Port: 3390
- Database: app
- User: root
- Password: root
Be careful: seeding and truncating are destructive operations — run only on local/dev environments unless you know what you're doing.
-
Always prefix project titles with
AD-. -
Place files in their respective CI4 folders (
Controllers/,Services/,Repositories/,Views/). -
Naming conventions:
Type Case Example Classes PascalCase UserService.phpInterfaces PascalCase UserRepositoryInterfaceDB tables/fields snake_case users,created_atDocs kebab-case dev-manual.md -
Git commits use:
feat,fix,docs,refactor. -
Use Controller → Service → Repository pattern.
-
Assets (CSS/JS/img) live under
public/. -
Docker configs are at the repo root (
docker-compose.yml,nginx.conf). -
Docs are maintained in
/docs(dev, technical, sop, commit, principles, copilot).
Example structure:
AD-ProjectName/
├─ backend/ci4/
│ ├─ app/Controllers/
│ ├─ app/Services/
│ ├─ app/Repositories/
│ ├─ app/Views/
│ ├─ public/
│ ├─ writable/
│ ├─ .env
│ └─ composer.json
├─ docker/ # Docker configs at root
├─ docs/ # Manuals and project docs
├─ .gitignore
└─ readme.md
| Title | Purpose | Link |
|---|---|---|
| ChatGPT | General AI assistance for planning application architecture and docs. | https://chat.openai.com |
| GitHub Copilot | In-IDE code suggestions and boilerplate generation. | https://github.com/features/copilot |
| YouTube “UI/UX Design” | Video tutorials on modern web interface layouts and patterns. | https://www.youtube.com |
| Pinterest Design Boards | Inspiration for color schemes, typography, and component layouts. | https://www.pinterest.com |
| Google Photos (Assets) | Stock imagery and graphics used in UI mockups and documentation. | https://photos.google.com |
| System Documentation | Internal docs from PHP, MongoDB, and PostgreSQL used in development. | — (see /docs folder in repo) |
