|
| 1 | +# PipeFlow |
| 2 | + |
| 3 | +PipeFlow is a pragmatic PHP **8.5+** framework that leans hard into **functional composition** (pipeline style) while still giving you familiar MVC ergonomics (controllers, models, views, migrations) + a CLI scaffold. |
| 4 | + |
| 5 | +## Quickstart |
| 6 | + |
| 7 | +```bash |
| 8 | +composer install |
| 9 | +cp .env.example .env |
| 10 | +php pipeflow serve |
| 11 | +``` |
| 12 | + |
| 13 | +Open: `http://127.0.0.1:8000` |
| 14 | + |
| 15 | +## Documentation |
| 16 | + |
| 17 | +- Main docs: `docs/README.md` |
| 18 | +- Architecture overview: `docs/ARCHITECTURE.md` |
| 19 | +- Per-file reference: `docs/reference/` |
| 20 | +- Codex / AI contributor notes: `docs/CODEX.md` |
| 21 | + |
| 22 | +## Routing |
| 23 | + |
| 24 | +Routes live in `routes/web.php`: |
| 25 | + |
| 26 | +```php |
| 27 | +$router = app(\PipeFlow\Router\Router::class); |
| 28 | +$router->get('/', [\App\Controllers\HomeController::class, 'index'], 'home'); |
| 29 | +``` |
| 30 | + |
| 31 | +### Conn + Plugs (Phoenix-inspired) |
| 32 | + |
| 33 | +PipeFlow now supports Phoenix-ish request flow using a `Conn` object and a plug pipeline. |
| 34 | + |
| 35 | +- `PipeFlow\Http\Conn` carries Request, Response, session, assigns, etc. |
| 36 | +- Plugs implement `PipeFlow\Plug\Contracts\PlugInterface` and are composed via `PlugStack`. |
| 37 | +- Built-in plugs: `SessionPlug`, `CsrfPlug` (enabled by default in the Kernel). |
| 38 | + |
| 39 | +Write a route handler that receives a Conn: |
| 40 | + |
| 41 | +```php |
| 42 | +use PipeFlow\Http\Conn; |
| 43 | + |
| 44 | +$router->get('/hello', function (Conn $conn) { |
| 45 | + return $conn->assign('name', 'world')->render('hello'); |
| 46 | +}); |
| 47 | +``` |
| 48 | + |
| 49 | +## Views |
| 50 | + |
| 51 | +`view('welcome', ['title' => 'PipeFlow'])` renders `resources/views/welcome.php`. |
| 52 | + |
| 53 | +## Models |
| 54 | + |
| 55 | +Create a model: |
| 56 | + |
| 57 | +```bash |
| 58 | +php pipeflow make:model Post --migration |
| 59 | +``` |
| 60 | + |
| 61 | +Base model lives at `PipeFlow\Database\Model`. |
| 62 | + |
| 63 | +## Migrations |
| 64 | + |
| 65 | +```bash |
| 66 | +php pipeflow migrate |
| 67 | +php pipeflow migrate:rollback --steps=1 |
| 68 | +``` |
| 69 | + |
| 70 | +Migrations live in `database/migrations`. |
| 71 | + |
| 72 | +## Functional pipeline |
| 73 | + |
| 74 | +Use the global `pipe()` helper: |
| 75 | + |
| 76 | +```php |
| 77 | +$result = pipe('hello', |
| 78 | + fn($s) => strtoupper($s), |
| 79 | + fn($s) => $s . ' WORLD' |
| 80 | +); |
| 81 | +``` |
| 82 | + |
| 83 | +## License |
| 84 | + |
| 85 | +MIT |
0 commit comments