PHPackages                             esign/craft-cms-crud - 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. esign/craft-cms-crud

ActiveCraft-plugin[Admin Panels](/categories/admin)

esign/craft-cms-crud
====================

This module contains the basic CRUD programmatically functions for Craft CMS

2.0.1(1y ago)0191[1 PRs](https://github.com/esign/craft-cms-crud/pulls)MITPHPPHP ^8.1

Since Jan 9Pushed 1y ago2 watchersCompare

[ Source](https://github.com/esign/craft-cms-crud)[ Packagist](https://packagist.org/packages/esign/craft-cms-crud)[ Docs](https://github.com/esign/craft-cms-crud)[ RSS](/packages/esign-craft-cms-crud/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (1)Versions (22)Used By (0)

Craft Programmatically CRUD
===========================

[](#craft-programmatically-crud)

This module contains the basic CRUD functions for Craft CMS

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

[](#installation)

You can install the package via composer, and Craft to install it:

```
composer require esign/craft-cms-crud && php craft plugin/install craft-cms-crud
```

Usage
-----

[](#usage)

### updateOrCreateEntry

[](#updateorcreateentry)

Currently there is only one function and that is `updateOrCreateEntry`, this can update an entry with all his fields (fields, matrix blocks &amp; nested entries)

`$entry` has to be an instance of `esign\craftcmscrud\support\CraftEntry` then we are sure all fields can be mapped right

```
use esign\craftcmscrud\controllers\CraftEntryController;

class YourController extends CraftEntryController
{
    CraftEntryController::updateOrCreateEntry($entry);
}
```

Entry Objects
-------------

[](#entry-objects)

---

### **CraftEntry.php**

[](#craftentryphp)

```
use esign\craftcmscrud\support\CraftEntry;

new CraftEntry(
    $handle,
    $identifier,
    $fields,
    $matrixBlocks,
    $nestedEntries
)
```

`$handle` -&gt; expects your section handle name

`$identifier` -&gt; expects your identifier for that entry (used for updating an entry instead of creating one)

`$fields` -&gt; expects a stdClass of your entry fields (including title &amp; slug) `OR` an array of stdClasses of your entry fields (this is used for nested entries more on this later)

`$matrixBlocks` -&gt; expects an array of CraftMatrixBlock classes (see section CraftMatrixBlock)

`$nestedEntries` -&gt; expects an array of CraftEntry classes

### **CraftMatrixBlock.php**

[](#craftmatrixblockphp)

```
use esign\craftcmscrud\support\CraftMatrixBlock;

new CraftMatrixBlock(
    $handle,
    $handleBlock,
    $fields
)
```

`$handle` -&gt; expects your field handle name

`$handleBlock` -&gt; expects your matrix block handle name

`$fields` -&gt; expects an array of stdClasses of your matrix fields

### **CraftAsset.php**

[](#craftassetphp)

```
use esign\craftcmscrud\support\CraftAsset;

new CraftAsset(
    $handle,
    $imageUrl,
    $filename,
    $path,
)
```

`$handle` -&gt; expects your field handle name

`$imageUrl` -&gt; expects your external image url

`$filename` -&gt; expects filename

`$path` -&gt; expects the path of your asset field

Example
-------

[](#example)

---

```
use esign\craftcmscrud\controllers\CraftEntryController;
use esign\craftcmscrud\support\CraftEntry;
use esign\craftcmscrud\support\CraftMatrixBlock;

CraftEntryController::updateOrCreateEntry(
    new CraftEntry(
        self::HANDLE_CLUB,
        self::IDENTIFIER_CLUB,
        ClubModel::fieldsFromClub($club),
        [
            new CraftMatrixBlock(
                self::HANDLE_OPENING_HOURS,
                self::HANDLE_OPENING_HOURS_BLOCK,
                $club->{self::HANDLE_OPENING_HOURS}
            ),
            ...
        ],
        [
            new CraftEntry(
                self::HANDLE_CLUB_TAGS,
                self::IDENTIFIER_CLUB_TAGS,
                ClubModel::collectionFieldsFromClubTags($club->{self::HANDLE_CLUB_TAGS})
            ),
            ...
        ],
        [
            new CraftAsset(
                self::HANDLE_IMAGE,
                $contract->mlContractImageUrl,
                StringHelper::beforeFirst(StringHelper::afterLast($contract->mlContractImageUrl, '/'), '?'),
                self::HANDLE_IMAGE_PATH
            )
        ],
    ),
);
```

parseNestedMatrixBlocks
-----------------------

[](#parsenestedmatrixblocks)

---

```
use esign\craftcmscrud\controllers\CraftEntryController;
use esign\craftcmscrud\support\CraftEntry;
use esign\craftcmscrud\support\CraftMatrixBlock;

public const MATRIX_BLOCKS_CONTRACT_TERM = [
    'mlTermPriceAdjustmentRules' => 'mlPriceBlock',
    'mlTermFlatFees' => 'mlFeeBlock',
    'mlTermOptionalModules' => 'mlOptionalBlock',
    'mlTermRateBonusPeriods' => 'mlBonusBlock',
];

CraftEntryController::updateOrCreateEntry(
    new CraftEntry(
        self::HANDLE_CONTRACT,
        self::IDENTIFIER_CONTRACT,
        Entry::fieldsFromContract($contract),
        null,
        [
            new CraftEntry(
                self::HANDLE_CONTRACT_TERM,
                self::IDENTIFIER_CONTRACT_TERM,
                Entry::collectionFieldsFromContractTerms(
                    $contract->{self::HANDLE_CONTRACT_TERM}
                ),
                CraftEntryController::parseNestedMatrixBlocks(
                    $contract->{self::HANDLE_CONTRACT_TERM},
                    self::MATRIX_BLOCKS_CONTRACT_TERM
                ),
            ),
        ],
    ),
);
```

`CraftEntryController::parseNestedMatrixBlocks()` is used to parse the nested matrix blocks.

`MATRIX_BLOCKS_CONTRACT_TERM` is the $sectionHandle =&gt; $blockHandle

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Recently: every ~86 days

Total

17

Last Release

603d ago

Major Versions

1.1.4 → 2.0.02023-11-27

### Community

Maintainers

![](https://www.gravatar.com/avatar/4599d7a8f6fdb63dd04305a49ae5ec9700b7a6eacdbe3a54f89584d75e34503f?d=identicon)[esign](/maintainers/esign)

---

Top Contributors

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

---

Tags

crudcraftcmsesign

### Embed Badge

![Health badge](/badges/esign-craft-cms-crud/health.svg)

```
[![Health](https://phpackages.com/badges/esign-craft-cms-crud/health.svg)](https://phpackages.com/packages/esign-craft-cms-crud)
```

###  Alternatives

[spicyweb/craft-neo

A Matrix-like field type with block hierarchy

393813.5k10](/packages/spicyweb-craft-neo)[craftcms/feed-me

Import content from XML, RSS, CSV or JSON feeds into entries, categories, Craft Commerce products, and more.

293952.6k33](/packages/craftcms-feed-me)[verbb/formie

The most user-friendly forms plugin for Craft.

102393.6k69](/packages/verbb-formie)[craftcms/commerce

Craft Commerce

240425.9k185](/packages/craftcms-commerce)[verbb/cp-nav

Manage the Craft Control Panel navigation.

128188.8k3](/packages/verbb-cp-nav)[verbb/vizy

A flexible visual editor field for Craft.

4250.4k](/packages/verbb-vizy)

PHPackages © 2026

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