atk4/data
ATK Data is a PHP data model abstraction that separates business logic from UI and persistence. Works with SQL/NoSQL/APIs, supports relations, expressions, aggregation, and user actions with ACL metadata—integrates easily with ATK UI and ATK API.
atk4/data excels as a data mapper rather than a traditional ORM, aligning well with Laravel’s service-layer architecture. It enforces a separation of concerns between business logic (models), persistence (SQL/NoSQL/API), and presentation (UI/API), which is critical for scalable Laravel applications.Client, Invoice) maps naturally to Laravel’s repository pattern or service-layer abstractions, enabling cleaner domain modeling.atk4/laravel-ad), integrating models into Laravel’s DI system.atk4/data is not a drop-in replacement for Eloquent. Requires adaptation (e.g., wrapping Eloquent models in atk4/data adapters).atk4/api (under development). Can generate REST endpoints from models with minimal boilerplate.atk4/ui components (e.g., Crud, Grid), enabling server-side rendering without heavy frontend frameworks.atk4/data model hooks (e.g., afterSave, beforeDelete) for business logic execution.atk4/data’s data-set-oriented approach (e.g., Model->ref('relation')->action('sum', 'price')).atk4/core, atk4/ui). Laravel-specific guides are limited.Model->getAll()) can be memory-intensive for large tables. Mitigated by lazy loading and cursor-based pagination.Schema::table). Database schema changes must be managed manually or via atk4/data’s migrator scripts.atk4/core (~500KB) and optionally atk4/ui (~1MB). For lightweight Laravel apps, this may be overkill.atk4/data’s abstraction power?atk4/data’s server-side focus?atk4/data replace only the data layer (e.g., repositories) or entirely replace Eloquent?atk4/ui for frontend rendering (reducing Laravel Blade usage)?atk4/laravel-ad package?atk4/data as a Laravel service provider to bind models to the container.
// app/Providers/Atk4ServiceProvider.php
public function register()
{
$this->app->singleton(\Atk4\Data\Model::class, function ($app) {
return new \Atk4\Data\Model($app->make(\Atk4\Data\Persistence::class));
});
}
Atk4::model('Client')) for convenience.atk4/data’s SQL persistence with Laravel’s database config (config/database.php).atk4/data models.
// app/Repositories/ClientRepository.php
class ClientRepository
{
public function __construct(protected \Atk4\Data\Model $model) {}
public function getVipClients() {
return $this->model->addCondition('is_vip', true);
}
}
atk4/data actions for complex logic (e.g., Model->action('calculateProfit')).atk4/data side-by-side (e.g., dual Client classes).atk4/ui components.atk4/data models.atk4/data utilities (e.g., php artisan atk4:migrate).atk4/data’s model testing helpers alongside Laravel’s PHPUnit.atk4/data ACL (e.g., Model->addCondition('user_id', auth()->id())).atk4/ui forms.atk4/data hooks (e.g., Model::on('afterSave', fn() => event(new ModelSaved($model)))).atk4/data models for subscription data but keep Cashier for billing logic.atk4/data equivalents.atk4/ui components (e.g., Crud, Grid) into Laravel Blade.atk4/ui.How can I help you explore Laravel packages today?