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