atlas/table
Atlas.Table is a table data gateway for Atlas, providing a clean API to interact with database tables. Built to support Atlas.Mapper but usable on its own, it helps you run queries and persist table rows with a focused, lightweight design.
beforeInsertRow, afterUpdateRow) enable cross-cutting concerns (e.g., logging, validation) without polluting model logic. This aligns with Laravel’s service layer patterns but at a lower level._TableSelect classes, IteratorAggregate for Row) improve developer velocity and reduce runtime errors (e.g., column typos).ConnectionLocator), but requires manual query building (no integration with Laravel’s Builder or Query).updateRowPerform() mandate a primary key, which may conflict with:
['user_id', 'post_id']).Model binding, no HasMany relationships).Select objects to Laravel’s Builder.return_type_declaration, named arguments, or union types.TableEvents (e.g., beforeUpdateRow() returning ?array) require refactoring existing event listeners.Row::assertValidValue() adds runtime checks, which may impact:
INSERT/UPDATE batches).saving, saved, deleting events; requires custom event mapping.SoftDeletes trait.updateRowPerform()/deleteRowPerform()?Row::assertValidValue() in bulk operations?IteratorAggregate feature impact memory usage for large rows?ConnectionLocator, which can be bridged to Laravel’s DB facade via a custom ConnectionLocator implementation.Select objects to Laravel’s Builder or hybrid usage (e.g., use Atlas.Table for CRUD, Laravel Query Builder for complex queries).TableGatewayInterface).Schema builder).Row objects to Eloquent entities.users table with basic CRUD).ConnectionLocator to bridge Atlas.Table to Laravel’s DB facade.// Atlas.Table for simple CRUD
$table = new UserTable($connectionLocator);
$user = $table->fetchRow(1);
// Laravel Query Builder for complex logic
$query = DB::table('users')->whereHas('posts')->get();
beforeInsertRow for validation).class UserTableEvents implements TableEvents {
public function beforeInsertRow(?array $values): ?array {
if (empty($values['email'])) {
throw new \InvalidArgumentException("Email is required.");
}
return $values;
}
}
| Feature | Atlas.Table Support | Laravel Workaround |
|---|---|---|
| Primary Key | Required | Custom adaptation for composite/UUID PKs |
| Composite Keys | ❌ No | Ext |
How can I help you explore Laravel packages today?