Demonstrates PHP's module feature through a todo list domain.
| Feature | How It's Shown |
|---|---|
module { } block |
Todo.php — claims all members |
Inline const |
MAX_ITEMS_PER_LIST |
| Forward declarations (claims) | 6 claims + nested module claim |
public class |
TaskList, Task, ListRepository, Renderable, ListError |
internal trait |
HasTimestamps — usable only inside the module |
internal(set) property |
Task::$completed — readable, writeable only inside module |
internal method |
TaskList::reorderTasks() |
| Nested module | Todo::Storage — groups ListMapper, TaskMapper |
extends across boundary |
Outside PriorityTask extends Todo::Task |
implements across boundary |
Outside JsonExport implements Todo::Renderable |
project-todo/
├── README.md
├── composer.json
├── entry.php
└── src/
├── Todo.php
└── Todo/
├── TaskList.php
├── Task.php
├── ListRepository.php
├── Renderable.php
├── ListError.php
├── HasTimestamps.php
└── Storage/
├── ListMapper.php
└── TaskMapper.php