Download the PHP package waffle-commons/data without Composer
On this page you can find all versions of the php package waffle-commons/data. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download waffle-commons/data
More information about waffle-commons/data
Files in waffle-commons/data
Package data
Short Description Data component for Waffle framework.
License MIT
Informations about the package data
Waffle Data Component
Release:
0.1.0-beta4|CHANGELOG.md
The data & persistence layer for the Waffle Framework (RFC-022). Built for FrankenPHP resident-worker mode: a warm connection pool, a backend-agnostic query AST, parameterized SQL / Firestore compilers, a property-hook hydrator, and a stateless SQL migration runner. No stateful ORM, no identity map, no change tracking โ a row becomes an immutable value object and nothing more.
๐ฆ Installation
Requires PHP 8.5+ and ext-pdo. Depends only on waffle-commons/contracts (plus PSR + PHP core).
๐งฑ Surface
| Class | Role |
|---|---|
Waffle\Commons\Data\Connection\PDOConnectionPool |
final pool of reusable PDO connections (ConnectionPoolInterface + ResettableInterface). Ping-before-dispense (SELECT 1), transparent reconnect, per-connection statement cache, reset() rolls back dangling transactions between requests. |
Waffle\Commons\Data\Query\Criteria |
Static factory for predicates: eq/neq/gt/gte/lt/lte/like/in/notIn. |
Waffle\Commons\Data\Query\Query |
Immutable, copy-on-write query AST (select / from / where / orderBy / limit / offset). Pure representation โ knows nothing about any backend. |
Waffle\Commons\Data\Query\Operator / Direction |
enum operators (=, <>, >, โฆ, IN, LIKE) and sort directions (ASC / DESC). |
Waffle\Commons\Data\Compiler\SQLCompiler / SQLWriteCompiler |
Compile a Query (reads) or a mapped entity row (INSERT/UPDATE/DELETE) into parameterized statements (? placeholders, injection-safe) for a chosen SQLDialect. |
Waffle\Commons\Data\Compiler\SQLDialect |
enum MySQL / MariaDB / SQLite / MSSQL / PostgreSQL / Oracle โ identifier quoting + pagination grammar. |
Waffle\Commons\Data\Compiler\FirestoreCompiler |
Compiles a Query into a CompiledFirestoreQuery with path isolation; only equality is pushed server-side, ranges/ordering flag requiresInMemoryFilter. |
Waffle\Commons\Data\Compiler\FirestoreScope |
public(appId, collection) / private(appId, userId, collection) path scoping. |
Waffle\Commons\Data\Compiler\{Mongo,KeyValue,Cassandra,GraphQL}Compiler |
Per-backend SQR compilers: MongoDB filter documents, key-value GET/MGET plans, parameterised CQL, GraphQL query/mutation documents. |
Waffle\Commons\Data\Repository\โฆ |
Seven stateless WritableRepositoryInterface repositories โ SQLRepository, FirestoreRepository (three auth guardrails), MongoRepository, CassandraRepository, KeyValueRepository, GraphQLRepository, JsonFileRepository โ full CRUD through pure DataMapperInterface mappers. |
Waffle\Commons\Data\Driver\โฆ |
Live drivers: FirestoreRestClient, MongoDriverSession, RedisKeyValueClient, GraphQLExecutor (+ the injectable CQL port). Every backend failure is rethrown as a sanitized DatabaseException. |
Waffle\Commons\Data\Evaluation\InMemoryEvaluator |
Stateless fetch-then-filter evaluation (range/set/sort/offset) for backends with restricted server-side querying. |
Waffle\Commons\Data\Storage\JsonFileStore |
Atomic flat-file JSON store (read-modify-write under LOCK_EX). |
Waffle\Commons\Data\Hydrator\PropertyHookHydrator |
Maps a raw row onto an immutable DTO via its constructor; corrupt data is rejected by the DTO's PHP 8.5 set hooks as a ValidationExceptionInterface. |
Waffle\Commons\Data\Migration\MigrationRunner |
MigrationRunnerInterface โ applies versioned *.sql files in order, tracked in waffle_migrations; each migration runs in its own transaction. |
Waffle\Commons\Data\Warmup\QueryWarmer |
DataWarmerInterface โ pre-compiles named SQR trees into an atomic <?php return [โฆ] artifact primed into OPcache (bin/waffle data:warmup, Beta-3). |
Waffle\Commons\Data\Exception\DatabaseException |
DatabaseExceptionInterface โ wraps any backend failure, lifts the ANSI SQLSTATE from a PDOException. |
Waffle\Commons\Data\Exception\ValidationException |
ValidationExceptionInterface โ a field-aware hydration/validation failure (surfaces as RFC 7807 422). |
๐ Quick start
Connection pool
Build a query, compile it for a backend
The same Query compiles to a Firestore payload via FirestoreCompiler with a FirestoreScope (public vs per-user path isolation).
Hydrate an immutable DTO
Run migrations (from the CLI)
MigrationRunner is wired into the console as bin/waffle db:migrate (see the console component). Programmatically:
๐ PHP 8.5 features used
final readonly classfor every value object (CompiledQuery,CompiledFirestoreQuery,Comparison,Order,FirestoreScope).- Property Hooks โ DTOs validate inside their own
sethooks; the hydrator never sees invalid state. (A hooked DTO isfinal class+public private(set), since hooked properties cannot bereadonly.) - Asymmetric visibility (
public private(set)) on the immutableQuerybuilder. - First-class callable syntax (
$this->method(...)) in the compilers;enumwith methods (Operator::isSetOperator());never-returning rejection helpers; typed class constants.
๐งญ Architectural boundary (mago guard)
Production code under Waffle\Commons\Data may depend only on Waffle\Commons\Data\**, Waffle\Commons\Contracts\**, Psr\**, and @global + Psl\**. A forbidden use fails the build, not a reviewer โ enforced by vendor/bin/mago guard (bundled into composer mago, zero baselines). Interfaces must be named *Interface, Exception\** classes must end in *Exception, and any Enum\** namespace may hold only enum declarations.
Contract-first, component-agnostic by construction: the data layer composes with the rest of the framework through waffle-commons/contracts, never directly through another component.
๐งช Testing
The full gate (composer mago && composer tests) runs format, lint, analyze, guard, and PHPUnit (โฅ95% line coverage) with zero baselines.
๐ License
MIT โ see LICENSE.md.
All versions of data with dependencies
ext-pdo Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
waffle-commons/contracts Version self.version