PHPackages                             rougin/dextra - 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. [API Development](/categories/api)
4. /
5. rougin/dextra

ActiveLibrary[API Development](/categories/api)

rougin/dextra
=============

"Ready-to-eat" CRUD for frontend.

v0.1.1(1mo ago)0776MITPHPPHP &gt;=5.3.0CI passing

Since May 23Pushed 1mo agoCompare

[ Source](https://github.com/rougin/dextra)[ Packagist](https://packagist.org/packages/rougin/dextra)[ Docs](https://github.com/rougin/dextra)[ RSS](/packages/rougin-dextra/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

Dextra
======

[](#dextra)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5b91c2e6079beb602c26c19b83d9777da668dff77aa5f1e08b2eed68d7817e0c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f7567696e2f6465787472612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rougin/dextra)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/rougin/dextra/blob/master/LICENSE.md)[![Build Status](https://camo.githubusercontent.com/e62e28e5d06f8f149ba122148e3f362cd62701d06bbde5dd22822ce9952c0771/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f726f7567696e2f6465787472612f6275696c642e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/rougin/dextra/actions)[![Coverage Status](https://camo.githubusercontent.com/f6042cb7ffe66027ddf8cc455e44a3598491f325414044dd97639e4a032a4607/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f726f7567696e2f6465787472613f7374796c653d666c61742d737175617265)](https://app.codecov.io/gh/rougin/dextra)[![Total Downloads](https://camo.githubusercontent.com/73294b4fec8f37a45b69b1899ee2c26f4f4feee781db250cb4f99d6663aea0a8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f7567696e2f6465787472612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rougin/dextra)

`Dextra` is a PHP utility package that provides templates based on [alpine.js](https://alpinejs.dev/) for handling frontend CRUD.

```

withInit() ?>

withLoad(10)->setLink('/v1/items') ?>

withStore()
  ->addField('name')
  ->setAlert('Created!', 'Item created.')
  ->setLink('/v1/items') ?>

```

Installation
------------

[](#installation)

Install the package using [Composer](https://getcomposer.org/):

```
$ composer require rougin/dextra
```

Basic usage
-----------

[](#basic-usage)

Use the `Depot` class to initialize the CRUD methods:

```
// app/plates/items/depot.php

// ...

```

Then use the available methods below once defined:

### withInit

[](#withinit)

Creates an `init` method. This method initializes any defined `Select` elements using [tom-select](https://tom-select.js.org/). After initialization, it calls the `load` method with the initial page number to fetch data:

```
// app/plates/items/depot.php

// ...

withInit(1) ?>

```

### withLoad

[](#withload)

Creates the `load` method. This method fetches paginated data from a `GET` request. Upon receiving a response, it updates the component's `items` data property with the fetched data and the `limit` data property with the expected items per page (e.g., `10`):

```
// app/plates/items/depot.php

// ...

withLoad(10)
  ->setLink($url->set('/v1/items')) ?>

```

It also provides configuration for `page` and `limit` keys by using `setPageKey` and `setLimitKey` methods respectively. The default values are `p` for `page` and `l` for `limit`:

```
// app/plates/items/depot.php

// ...

withLoad(10)
  ->setPageKey('p')
  ->setLimitKey('l')
  ->setLink($url->set('/v1/items')) ?>

```

### withStore

[](#withstore)

Creates a `store` method. This is used for sending a `POST` request to the specified link to create a new item. It collects data from the defined fields, and shows an alert upon successful creation before reloading the data:

```
// app/plates/items/depot.php

// ...

withStore()
  ->addField('name')
  ->addField('detail')
  ->setAlert('Item created!', 'Item successfully created.')
  ->setLink($url->set('/v1/items')) ?>

```

### withEdit

[](#withedit)

Creates an `edit` method. This method is used to populate a modal with the data of a selected item. It takes an `item` object as a parameter and assigns its properties to the corresponding fields in the modal. It can also show or hide other modals:

```
// app/plates/items/depot.php

// ...

withEdit()
  ->addField('name')
  ->addField('detail')
  ->addField('id')
  ->showModal('item-detail-modal') ?>

```

### withUpdate

[](#withupdate)

Creates an `update` method. This method is used for sending a `PUT` request to the specified link to update an existing item. It collects data from the defined fields, includes the item's ID in the request, and shows an alert upon successful update before reloading the data:

```
// app/plates/items/depot.php

// ...

withUpdate()
  ->addField('name')
  ->addField('detail')
  ->setAlert('Item updated!', 'Item successfully updated.')
  ->setLink($url->set('/v1/items')) ?>

```

### withTrash

[](#withtrash)

Creates a `trash` method. This method is used to populate a modal for confirming the deletion of an item. It takes an `item` object as a parameter and assigns its properties to the corresponding fields in the modal. It can also show or hide other modals:

```
// app/plates/items/depot.php

// ...

withTrash()
  ->addField('name')
  ->addField('id')
  ->showModal('delete-item-modal') ?>

```

### withRemove

[](#withremove)

Creates a `remove` method. This method is used for sending a `DELETE` request to the specified link to remove an item. It takes the item's ID as a parameter, includes it in the request, and shows an alert upon successful deletion before reloading the data:

```
// app/plates/items/depot.php

// ...

withRemove()
  ->setAlert('Item deleted!', 'Item successfully deleted.')
  ->setLink($url->set('/v1/items')) ?>

```

### withClose

[](#withclose)

Creates a `close` method. This method is used to close modals and reset the values of specified fields. It can also hide other modals and reset fields based on a provided script:

```
// app/plates/items/depot.php

// ...

withClose()
  ->withScript($script)
  ->hideModal('delete-item-modal')
  ->hideModal('item-detail-modal')
  ->resetField('detail')
  ->resetField('error')
  ->resetField('id')
  ->resetField('name')
  ->resetField('loadError') ?>

```

The `setDefaults` method can also be used for resetting the data with default values:

```
// app/plates/items/depot.php

script('items')
  ->with('name')
  ->with('detail')
  ->with('items', array())
  ->with('empty', false)
  ->with('loadError', false)
  ->with('id', null)
  ->with('delete', false)
  ->withError()
  ->withLoading() ?>

withClose()
  ->setDefaults($script->getFields()) ?>

// ...

```

Note

The `Script` class from [Fortem](https://github.com/rougin/fortem) can be used for resetting the data.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](https://github.com/rougin/dextra/blob/master/CHANGELOG.md) for more recent changes.

Contributing
------------

[](#contributing)

See [CONTRIBUTING](https://github.com/rougin/dextra/blob/master/CONTRIBUTING.md) on how to contribute to the project.

License
-------

[](#license)

The MIT License (MIT). Please see [LICENSE](https://github.com/rougin/dextra/blob/master/LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance94

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 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 ~7 days

Total

2

Last Release

32d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c7721589a958a1fbcef1b527c794d820d75b82988f14b2ed86a1c6904d76a59e?d=identicon)[rougin](/maintainers/rougin)

---

Top Contributors

[![rougin](https://avatars.githubusercontent.com/u/6078637?v=4)](https://github.com/rougin "rougin (29 commits)")

---

Tags

php-crudphp-uiui-templatephp-crudphp-uiui-template

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rougin-dextra/health.svg)

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[magento/community-edition

Magento 2 (Open Source)

12.2k53.6k13](/packages/magento-community-edition)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k14](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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