PHPackages                             alxarafe/resource-controller - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. alxarafe/resource-controller

ActiveLibrary[Admin Panels](/categories/admin)

alxarafe/resource-controller
============================

ORM-agnostic declarative CRUD controller for PHP. Auto-generates list/edit UIs from field metadata.

0.2.2(1mo ago)03634GPL-3.0-or-laterPHPPHP ^8.2CI passing

Since Apr 22Pushed 1mo agoCompare

[ Source](https://github.com/alxarafe/resource-controller)[ Packagist](https://packagist.org/packages/alxarafe/resource-controller)[ RSS](/packages/alxarafe-resource-controller/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (4)Versions (6)Used By (4)

alxarafe/resource-controller
============================

[](#alxaraferesource-controller)

[![PHP Version](https://camo.githubusercontent.com/0850ed948ac3ac730f3c66764c4e21ea1163f0b76bf9624c97c8c0be7af8f050/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322b2d626c756576696f6c65743f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/0850ed948ac3ac730f3c66764c4e21ea1163f0b76bf9624c97c8c0be7af8f050/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322b2d626c756576696f6c65743f7374796c653d666c61742d737175617265)[![CI](https://github.com/alxarafe/resource-controller/actions/workflows/ci.yml/badge.svg)](https://github.com/alxarafe/resource-controller/actions/workflows/ci.yml/badge.svg)[![Tests](https://github.com/alxarafe/resource-controller/actions/workflows/tests.yml/badge.svg)](https://github.com/alxarafe/resource-controller/actions/workflows/tests.yml/badge.svg)[![Static Analysis](https://camo.githubusercontent.com/949a823ae3b18f7450026518eb003044528051afb988a983a5b9d5f64cf48f40/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f737461746963253230616e616c797369732d5048505374616e2532302532422532305073616c6d2d626c75653f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/949a823ae3b18f7450026518eb003044528051afb988a983a5b9d5f64cf48f40/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f737461746963253230616e616c797369732d5048505374616e2532302532422532305073616c6d2d626c75653f7374796c653d666c61742d737175617265)[![PRs Welcome](https://camo.githubusercontent.com/dd0b24c1e6776719edb2c273548a510d6490d8d25269a043dfabbd38419905da/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e737667)](https://github.com/alxarafe/resource-controller/issues)

**ORM-agnostic declarative CRUD controller for PHP.**

Auto-generates list views, edit forms, filters, and actions from field metadata — without coupling to any specific ORM, template engine, or framework.

Features
--------

[](#features)

- 🏗️ **Declarative**: Define fields and columns, get full CRUD automatically
- 🔌 **ORM-Agnostic**: Works with Eloquent, Doctrine, PDO, REST APIs, or any data source
- 🎨 **UI Components**: 15 field types, panels, tabs, filters — all serializable to JSON
- 🪝 **Hook System**: Extensible lifecycle (before/after save, form field injection)
- 🌍 **i18n Ready**: Pluggable translator contract
- 📦 **Zero Dependencies**: Only requires PHP 8.2

Ecosystem
---------

[](#ecosystem)

This package is the core of the Alxarafe Resource ecosystem. Use it with the adapters that fit your stack:

PackagePurposeStatus**[resource-controller](https://github.com/alxarafe/resource-controller)**Core CRUD engine + UI components✅ Stable**[resource-eloquent](https://github.com/alxarafe/resource-eloquent)**Eloquent ORM adapter (Repository, Query, Transaction)✅ Stable**[resource-pdo](https://github.com/alxarafe/resource-pdo)**Generic PDO adapter (Repository, Query, Transaction)✅ StableInstallation
------------

[](#installation)

```
composer require alxarafe/resource-controller
```

For Eloquent support:

```
composer require alxarafe/resource-eloquent
```

For PDO support:

```
composer require alxarafe/resource-pdo
```

Quick Start
-----------

[](#quick-start)

```
use Alxarafe\ResourceController\AbstractResourceController;
use Alxarafe\ResourceController\Contracts\RepositoryContract;
use Alxarafe\ResourceController\Component\Fields\Text;
use Alxarafe\ResourceController\Component\Fields\Decimal;
use Alxarafe\ResourceController\Component\Fields\Boolean;

class ProductController extends AbstractResourceController
{
    public static function getModuleName(): string { return 'Shop'; }
    public static function getControllerName(): string { return 'Product'; }
    public static function url(string $action = 'index', array $params = []): string
    {
        return '/products' . ($action !== 'index' ? "/{$action}" : '');
    }

    protected function getRepository(string $tabId = 'default'): RepositoryContract
    {
        return new EloquentRepository(Product::class); // or any adapter
    }

    protected function getListColumns(): array
    {
        return [
            new Text('name', 'Name'),
            new Decimal('price', 'Price', ['min' => 0]),
            new Boolean('active', 'Active'),
        ];
    }

    protected function getEditFields(): array
    {
        return [
            'general' => [
                'label' => 'General',
                'fields' => [
                    new Text('name', 'Name', ['required' => true]),
                    new Decimal('price', 'Price'),
                    new Boolean('active', 'Active'),
                ],
            ],
        ];
    }
}
```

Architecture
------------

[](#architecture)

```
┌──────────────────────────────────────────────┐
│         Your Controller                       │
│  getRepository() → RepositoryContract         │
│  getListColumns() → Field[]                   │
│  getEditFields()  → Field[]                   │
├──────────────────────────────────────────────┤
│         ResourceTrait (this package)          │
│  buildConfiguration()                         │
│  handleRequest()                              │
│  fetchListData() / saveRecord()               │
├──────────────────────────────────────────────┤
│         Contracts                             │
│  RepositoryContract  TranslatorContract       │
│  QueryContract       MessageBagContract       │
│  TransactionContract HookContract             │
│  RendererContract                             │
└──────────────────────────────────────────────┘
         ↓ implemented by ↓
┌──────────────┐ ┌──────────────┐
│ Eloquent     │ │ PDO          │
│ Adapter      │ │ Adapter      │
└──────────────┘ └──────────────┘

```

Contracts
---------

[](#contracts)

ContractPurposeNull Default`RepositoryContract`Data access (CRUD + query)— (must implement)`QueryContract`Fluent query builder— (from Repository)`TransactionContract`DB transactions`NullTransaction``TranslatorContract`i18n / translations`NullTranslator``MessageBagContract`Flash messages`NullMessageBag``HookContract`Plugin extensibility`NullHookService``RendererContract`Template rendering— (optional)`RelationContract`Parent-child sync— (optional)Development
-----------

[](#development)

### Docker

[](#docker)

```
docker compose up -d
docker exec alxarafe-resources composer install
```

### Running the CI pipeline locally

[](#running-the-ci-pipeline-locally)

```
bash bin/ci_local.sh
```

This runs, in order: PHPCBF → PHPCS → PHPStan → Psalm → PHPUnit.

### Running tests only

[](#running-tests-only)

```
bash bin/run_tests.sh
```

License
-------

[](#license)

GPL-3.0-or-later

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance91

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

5

Last Release

42d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c3ef5787a3dd8f75636a6ab83a70d752c7f3f6cb71fe8e8b630e93b85ccd081?d=identicon)[rsanjoseo](/maintainers/rsanjoseo)

---

Top Contributors

[![rsanjoseo](https://avatars.githubusercontent.com/u/27363683?v=4)](https://github.com/rsanjoseo "rsanjoseo (15 commits)")

---

Tags

scaffoldingresourcecrudcontrolleradminERPorm-agnostic

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/alxarafe-resource-controller/health.svg)

```
[![Health](https://phpackages.com/badges/alxarafe-resource-controller/health.svg)](https://phpackages.com/packages/alxarafe-resource-controller)
```

###  Alternatives

[friendsofcake/crud

CakePHP Application development on steroids - rapid prototyping / scaffolding &amp; production ready code - XML / JSON APIs and more

3761.4M26](/packages/friendsofcake-crud)[laravelrus/sleepingowl

Administrative interface builder for Laravel.

804221.7k3](/packages/laravelrus-sleepingowl)[mineadmin/mineadmin

Quickly build a background management system for web applications

1.2k2.1k](/packages/mineadmin-mineadmin)[friendsofcake/crud-view

View layer for CRUD

52440.6k2](/packages/friendsofcake-crud-view)[brackets/admin-generator

Laravel 8 CRUD generator for brackets/craftable

50192.0k](/packages/brackets-admin-generator)[sandstorm/crudforms

Create easy CRUD forms for Domain Models in Flow and Neos CMS

2220.5k](/packages/sandstorm-crudforms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
