pilotphp / orm
Agent First ORM, schema planning and migrations for PilotPHP.
0.0.1
2026-07-07 13:05 UTC
Requires
- php: ^8.5
- ext-pdo: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.0
- rector/rector: ^2.0
README
PilotPHP ORM is an Agent First ORM, schema planning, PostgreSQL SQL generation and impact analysis package for PilotPHP.
Core rules:
- Plans before code.
- Diffs before migrations.
- Impact before apply.
- Readable manifests before magic.
- Deterministic output before clever automation.
This package is standalone and optional. It has no runtime dependency on Laravel, Illuminate, Symfony ORM, Doctrine ORM or Cycle ORM.
Manifest Example
<?php declare(strict_types=1); use PilotPHP\Orm\Schema\EntitySchema; return EntitySchema::make('User') ->module('User') ->table('users') ->field('uuid')->uuid()->primary() ->field('email')->string(255)->unique() ->field('name')->string(255) ->timestamps();
Planning Example
use PilotPHP\Orm\Plan\OrmPlanner; $plan = (new OrmPlanner())->plan($schema, timestamp: '20260707120000'); echo $plan->toJson();
Plans are deterministic and do not write files or apply database changes. A plan includes:
- normalized entity metadata;
- planned model, repository and migration paths;
- visible PostgreSQL SQL;
- validation warnings;
- impact risks.
Current MVP Limits
- Plans only; no files are written.
- PostgreSQL
CREATE TABLESQL only for schema manifests. - No real database execution in the planning pipeline.
- No ActiveRecord.
- No relations or lazy loading.
- No PilotPHP framework integration yet.
Development
composer install
composer test
composer analyse
composer check