Search by

b4moss / crudian

kohki

CRUD abstraction for DDD repositories (PDO + libSQL preview)

v0.12.0 2026-10-08 07:59 UTC

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).