PHPackages                             atk4/mastercrud - 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. [Framework](/categories/framework)
4. /
5. atk4/mastercrud

ActiveLibrary[Framework](/categories/framework)

atk4/mastercrud
===============

Multi-level CRUD system component for ATK UI

2.3.1(5y ago)99.7k7[1 issues](https://github.com/atk4/mastercrud/issues)[1 PRs](https://github.com/atk4/mastercrud/pulls)MITPHPPHP &gt;=7.3.0

Since May 13Pushed 2y ago7 watchersCompare

[ Source](https://github.com/atk4/mastercrud)[ Packagist](https://packagist.org/packages/atk4/mastercrud)[ Docs](https://github.com/atk4/multicrud)[ RSS](/packages/atk4-mastercrud/feed)WikiDiscussions develop Synced 2mo ago

READMEChangelog (6)Dependencies (4)Versions (10)Used By (0)

[ATK UI](https://github.com/atk4/ui) is a UI library for building UI interfaces that has a built-in [CRUD](http://ui.agiletoolkit.org/demos/crud.php) component. It can be used to create complex admin systems, but it requires you to populate multiple pages and inter-link them together yourself.

[![mastercrud](docs/images/mastercrud.png)](docs/images/mastercrud.png)

**MasterCrud** is an add-on for ATK UI and ATK Data, which will orchestrate navigation between multiple CRUD pages by respecting relations and conditions. You can use **MasterCrud** to:

- Manage list of clients, and their individual invoices and payments.
- Manage user groups and users within them
- Manage multi-level catalogue and products in them

The syntax of **MasterCrud** is incredibly simple and short. It automatically takes care of many details like:

- record and track `id` of various records you have clicked on (BreadCrumb)
- display multi-Tab pages with model details and optional relations
- support `hasOne` and `hasMany` relations
- allow flexible linking to a higher tree level (user - invoice - allocated\_payment -&gt; payment (drops invoice\_id))

**MasterCrud** can also be extended to contain your own views, you can interact with the menu and even place **MasterCrud** inside a more complex layouts.

### Example Use Case (see demos/clients.php for full demo):

[](#example-use-case-see-demosclientsphp-for-full-demo)

Assuming you have Clients with Invoices and Payments and you also want to add "Line"s for each Invoice, you may want to add this interface for the admin, where user can use drill-downs to navigate through data:

[![step1](docs/images/step1.png)](docs/images/step1.png)

Clicking on `Client 2` would bring you to a different page. Extra tabs Invoices and Payments offer you further way in:

[![step2](docs/images/step2.png)](docs/images/step2.png)

clicking on specific invoice, you can edit it's lines:

[![step3](docs/images/step3.png)](docs/images/step3.png)

On this screen however we turned off deletion of lines (because it is a demo). However clicking Edit brings up a Modal where you can easily update record data:

[![step4](docs/images/step4.png)](docs/images/step4.png)

All this UI can be created in just a few lines of code!

MasterCrud operates like a regular CRUD, and you can easily substitute it in:

```
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client');
```

You'll noticed that you can now click on the client name to get full details about this client. Next, we want to be able to see and manage Client invoices:

```
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client', ['Invoices' => []]);
```

This will add 2nd tab to the "Client Details" screen listing invoices of said client. If you invoice is further broken down into "Lines", you can go one level deeper:

```
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client', ['Invoices' => ['Lines' => []]]);
```

If `Client hasMany('Payments')` then you can also add that relation:

```
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client', ['Invoices' => ['Lines' => []], 'Payments' => []]);
```

With some cleanup, this syntax is readable and nice:

```
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client', [
    'Invoices' => [
        'Lines' => [],
    ],
    'Payments' => [],
]);
```

Support for actions
-------------------

[](#support-for-actions)

MasterCrud is awesome for quickly creating admin systems. But basic C,R,U,D operations are not enough. Sometimes you want to invoke custom actions for individual element. MasterCrud now supports that too:

```
$app->layout->add(new \Atk4\MasterCrud\MasterCrud())
    ->setModel(new \Saasty\Model\App($app->db),
    [
        'columnActions' => [
            'repair' => ['icon' => 'wrench'],
        ],
        'Models' => [
            'columnActions' => [
                'migrate' => ['icon' => 'database'],
            ],
            'Fields' => [
                'ValidationRules' => [],

            ],
            'Relations' => [
                'ImportedFields' => [],
            ],
        ],
```

[![actions](docs/images/actions.png)](docs/images/actions.png)

There are various invocation methods allowing you to specify icon, label, custom callbacks etc.

This also adds "MethodInvocator" - a view which asks you for arguments and then executes them.

This next example will use form to ask for an email, which will then be passed as argument to sendEmail($email)

```
[
    'columnActions' => [
         'sendEmail' => ['icon' => 'wrench', 'email' => 'string'],
   ]
]
```

### Installation

[](#installation)

Install through composer:

```
 composer require atk4/mastercrud
```

Also see introduction for [ATK UI](https://github.com/atk4/ui) on how to render HTML.

Roadmap
-------

[](#roadmap)

- Allow to specify custom CRUD seed. You can ever replace it with your own compatible view.
- Add custom actions and function invocation
- Create decent "View" mode (relies on ATK UI Card)
- Traverse hasOne references (see below)

---

> NOT IMPLEMENTED BELOW

Suppose that `Invoice hasMany(Allocation)`and `Payment hasMany(Allocation)` while allocation can have one Payment and one Invoice.

```
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client', [
    'Invoices' => [
        'Lines' => [],
        'Allocations' => [],
    ],
    'Payments' => [
        'Allocations' => [],
    ],
]);
```

That's cool, but if you go through the route of `Invoice -> allocation ->` you should be able to click on the "payment":

```
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client', [
    'Invoices' => [
        'Lines' => [],
        'Allocations' => [
            'payment_id' => ['path' => 'Payments', 'payment_id' => 'payment_id'],
        ],
    ],
    'Payments' => [
        'Allocations' => [
            'invoice_id' => ['path' => 'Invoices', 'invoice_id' => 'invoice_id'],
        ],
    ],
]);
```

Now you will be able to jump from `Invoice->allocation` to `Payment` and other way around.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 57.6% 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 ~110 days

Recently: every ~61 days

Total

9

Last Release

2034d ago

Major Versions

1.2.1 → 2.2.02020-10-06

PHP version history (4 changes)1.0.0PHP &gt;=5.6.0

1.1.0PHP &gt;=7.0.0

1.2.1PHP &gt;=7.2.0

2.2.0PHP &gt;=7.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/426ad318d07e7685454f7e449a9d0c9f005b83aef0777558d97d854ff9c28a5a?d=identicon)[romaninsh](/maintainers/romaninsh)

---

Top Contributors

[![DarkSide666](https://avatars.githubusercontent.com/u/1969119?v=4)](https://github.com/DarkSide666 "DarkSide666 (49 commits)")[![romaninsh](https://avatars.githubusercontent.com/u/453929?v=4)](https://github.com/romaninsh "romaninsh (24 commits)")[![ibelar](https://avatars.githubusercontent.com/u/2204478?v=4)](https://github.com/ibelar "ibelar (8 commits)")[![mvorisek](https://avatars.githubusercontent.com/u/2228672?v=4)](https://github.com/mvorisek "mvorisek (3 commits)")[![karakal](https://avatars.githubusercontent.com/u/2448293?v=4)](https://github.com/karakal "karakal (1 commits)")

---

Tags

agileatk4mastercrudphpframeworkdataAgilecrudmultiReferenceatk4recursiveagile ui

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/atk4-mastercrud/health.svg)

```
[![Health](https://phpackages.com/badges/atk4-mastercrud/health.svg)](https://phpackages.com/packages/atk4-mastercrud)
```

###  Alternatives

[atk4/login

Login and User module for Agile UI

2818.5k5](/packages/atk4-login)[atk4/filestore

Integration between ATK UI Form Upload Field and PHP Flysystem

1026.0k1](/packages/atk4-filestore)[amranidev/scaffold-interface

A Smart CRUD Generator For Laravel

92120.7k1](/packages/amranidev-scaffold-interface)[atk4/chart

Chart.js for Agile UI

1214.2k](/packages/atk4-chart)[zphp/zphp

ZPHP is a light that is dedicated to gaming, social networking, web, mobile server-side frameworks. Providing high performance real-time communication solutions.

5771.0k](/packages/zphp-zphp)[atk4/api

Agile API - Extensible API server in PHP for Agile Data

143.7k1](/packages/atk4-api)

PHPackages © 2026

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