b4moss / crudian
CRUD abstraction for DDD repositories (PDO + libSQL preview)
Requires
- php: >=8.3
- ext-pdo: *
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
Suggests
- ext-ffi: Required for turso/libsql (technical preview)
- ext-pdo_mysql: MySQL via PDO
- ext-pdo_pgsql: Postgres via PDO
- ext-pdo_sqlite: SQLite via PDO
- turso/libsql: libSQL adapter (technical preview)
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-23 11:14:29 UTC
README
CRUD facade matching the JavaScript / Go contract, for PDO and libSQL (technical preview).
composer require b4moss/crudian
Requires PHP 8.3+ and ext-pdo.
PDO
use B4moss\Crudian\WhereBuilder; use function B4moss\Crudian\Pdo\createCrud; $pdo = new PDO('sqlite::memory:'); $crud = createCrud($pdo); // inject; does not open connections $row = $crud->create('items', ['name' => 'alpha', 'score' => 1]); $page = $crud->search('items', [ 'where' => WhereBuilder::create()->eq('name', 'alpha'), 'limit' => 20, ]);
Dialect is inferred from the PDO driver (sqlite / pgsql / mysql), or set via Options:
use B4moss\Crudian\Options; use B4moss\Crudian\PostgresDialect; $crud = createCrud($pdo, new Options(dialect: new PostgresDialect(), pk: 'id'));
libSQL (technical preview)
Uses the official SDK (turso/libsql) behind a thin Executor. Requires ext-ffi. Remote Turso Cloud E2E is out of scope.
use function B4moss\Crudian\Libsql\createCrud; // $connection from turso/libsql (or a PDO-compatible stand-in in tests) $crud = createCrud($connection);
Contract
Methods: create / read / update / delete / search / list / count / exists / upsert / duplicate / bulk* / transaction.
Acceptance: docs/tests/v0.12.0.md. Design: docs/plans/php-module.md.
Laravel is not supported.
Test / lint
composer install
composer test
composer phpstan
Release
Version file: VERSION (not composer.json).
Monorepo git tag: packages/php/vX.Y.Z.
Packagist dist: b4moss/crudian-php tagged vX.Y.Z by that repo’s sync workflow (GITHUB_TOKEN, after monorepo Release).