PHPackages                             giantbits/yii2-crelish - 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. giantbits/yii2-crelish

ActiveYii2-extension[Framework](/categories/framework)

giantbits/yii2-crelish
======================

Content management for the Yii2 framework

0.21.6(3w ago)11.3kBSD-3-ClausePHPPHP &gt;=8.2.0

Since Jun 13Pushed 3w ago2 watchersCompare

[ Source](https://github.com/smeyerme/yii2-crelish)[ Packagist](https://packagist.org/packages/giantbits/yii2-crelish)[ RSS](/packages/giantbits-yii2-crelish/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (168)Versions (228)Used By (0)

yii2-crelish 0.4.8
==================

[](#yii2-crelish-048)

Content management for the Yii2 framework.

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

[](#installation)

1. Create Yii2 Basic project

```
composer global require "fxp/composer-asset-plugin:^1.2.0"
composer create-project --prefer-dist yiisoft/yii2-app-basic {projectname}

```

2. Install yii2-crelish

```
composer require giantbits/yii2-crelish

```

Setup
-----

[](#setup)

### configuration

[](#configuration)

Edit your web.php config file

```
// Add crelish to the bootstrap phase.
'bootstrap' => ['crelish', '...'],

// Configure components.
// Set default route.
'defaultRoute' => 'frontend/index',

// Configure view component to use twig.
'view' => [
  'class' => 'yii\web\View',
  'renderers' => [
    'twig' => [
      'class' => 'yii\twig\ViewRenderer',
      'cachePath' => '@runtime/Twig/cache',
      // Array of twig options:
      'options' => [
        'auto_reload' => true,
      ],
      'globals' => ['html' => '\yii\helpers\Html'],
      'uses' => ['yii\bootstrap']
    ],
  ]
]

// Enable file cache.
'cache' => [
  'class' => 'yii\caching\FileCache'
]

// Enable swift mailer.
'mailer' => [
  'class' => 'yii\swiftmailer\Mailer',
  'useFileTransport' => TRUE
]

// Use crelish user class
'user' => [
  'class'=>'giantbits\crelish\components\CrelishUser',
  'identityClass' => 'giantbits\crelish\components\CrelishUser',
  'enableAutoLogin' => true,
],

// Enable basic URL Manager.
'urlManager' => [
  'enablePrettyUrl' => TRUE,
  'showScriptName' => FALSE,
  'enableStrictParsing' => TRUE,
  'suffix' => '.html',
  'rules' => [
    // ...
  ]
]

// Finaly add Crelish to the config. (After component configuration)
$config['modules']['crelish'] = [
  'class' => 'giantbits\crelish\Module',
  'theme' => 'klangfarbe'
];

```

### Setting up folders

[](#setting-up-folders)

Create the following structure in you project root folder.

```
workspace/
	data/
		*Create folders for evey content type you use.*
		asset/
			*Content items of this type are stored here.*
			2131123123123123.json
			...
		page/
			*Content items of this type are stored here.*
			2131123123123123.json
			...
	elements/
		*Definitions for each content type are stored here.*
		asset.json
		page.json
	widgets/

```

Important additions
-------------------

[](#important-additions)

Currently the system relies on two cintent types to b epresent. Paste the following code into the folder workspace/elements/.

```
// File name: asset.json

{
  "key": "asset",
  "label": "Asset",
  "selectable": false,
  "tabs": [
  ],
  "groups": [
  ],
  "fields": [
    { "label": "Title internal", "key": "systitle", "type": "textInput", "visibleInGrid": true, "rules": [["required"], ["string", {"max": 128}]]},
    { "label": "Title", "key": "title", "type": "textInput", "visibleInGrid": false, "rules": [["required"], ["string", {"max": 128}]]},
    { "label": "Description",  "key": "description", "type": "textInput", "visibleInGrid": false, "rules": [["required"],["string", {"max": 320}]]},
    { "label": "MIME-Type",  "key": "mime", "type": "textInput", "visibleInGrid": false, "rules": [["required"],["string", {"max": 128}]]},
    { "label": "Source",  "key": "src", "type": "textInput", "visibleInGrid": false, "rules": [["required"],["string", {"max": 256}]]},
    { "label": "Size",  "key": "size", "type": "textInput", "visibleInGrid": false, "rules": [["required"],["integer"]]},
    { "label": "Dominant color HEX",  "key": "colormain_hex", "type": "textInput", "visibleInGrid": false, "rules": [["safe"]]},
    { "label": "Dominant color RGB",  "key": "colormain_rgb", "type": "textInput", "visibleInGrid": false, "rules": [["safe"]]},
    { "label": "Color palette",  "key": "colorpalette", "type": "textInput", "visibleInGrid": false, "rules": [["safe"]]}
  ]
}

```

```
// File name: page.json

{
  "key": "page",
  "label": "Page",
  "tabs": [
    {
      "label": "Content",
      "key": "content",
      "groups": [
        {
          "label": "Content",
          "key": "content",
          "settings": {
            "width": "60"
          },
          "fields": [
            "displaytitle",
            "body",
            "matrix"
          ]
        },
        {
          "label": "Settings",
          "key": "settings",
          "settings": {
            "width": "40"
          },
          "fields": [
            "systitle",
            "navtitle",
            "metadescription",
            "metakeywords"
          ]
        }
      ]
    }
  ],
  "fields": [
    {
      "label": "Title internal",
      "key": "systitle",
      "type": "textInput",
      "visibleInGrid": true,
      "rules": [
        [
          "required"
        ],
        [
          "string",
          {
            "max": 128
          }
        ]
      ]
    },
    {
      "label": "Title display",
      "key": "displaytitle",
      "type": "textInput",
      "visibleInGrid": false,
      "rules": [
        [
          "required"
        ],
        [
          "string",
          {
            "max": 128
          }
        ]
      ]
    },
    {
      "label": "Title navigation",
      "key": "navtitle",
      "type": "textInput",
      "visibleInGrid": false,
      "rules": [
        [
          "required"
        ],
        [
          "string",
          {
            "max": 128
          }
        ]
      ]
    },
    {
      "label": "Meta-Description",
      "key": "metadescription",
      "type": "textInput",
      "visibleInGrid": false,
      "rules": [
        [
          "required"
        ],
        [
          "string",
          {
            "max": 128
          }
        ]
      ]
    },
    {
      "label": "Meta-Keywords",
      "key": "metakeywords",
      "type": "textInput",
      "visibleInGrid": false,
      "rules": [
        [
          "required"
        ],
        [
          "string",
          {
            "max": 128
          }
        ]
      ]
    },
    {
      "label": "Content",
      "key": "body",
      "type": "widget_\\yii\\redactor\\widgets\\Redactor",
      "visibleInGrid": false,
      "rules": [
        [
          "required"
        ],
        [
          "string",
          {
            "max": 2300
          }
        ]
      ]
    },
    {
      "label": "References",
      "key": "matrix",
      "type": "matrixConnector",
      "rules": [
        [
          "safe"
        ]
      ]
    }
  ]
}

```

Content Type Generator
----------------------

[](#content-type-generator)

Crelish now provides a command-line tool to streamline the process of creating new content types. This tool automatically generates both the database table and the model class based on a JSON element definition.

### Usage

[](#usage)

1. Create a JSON element definition file in `@app/workspace/elements/` (e.g., `boardgame.json`)
2. Run the generator command:

```
./yii content-type/generate boardgame
```

This will:

- Create a database table for the content type
- Generate a model class with appropriate getters/setters for JSON fields
- Set up relations based on the element definition

### Listing Available Element Definitions

[](#listing-available-element-definitions)

To see all available element definitions:

```
./yii content-type/list
```

### Element Definition Format

[](#element-definition-format)

The element definition should follow the standard Crelish format, with the addition of a `storage` property to specify whether to use database or JSON storage:

```
{
  "key": "boardgame",
  "storage": "db",
  "label": "Board Games",
  "category": "Content",
  "fields": [
    {
      "label": "Title",
      "key": "systitle",
      "type": "textInput",
      "visibleInGrid": true,
      "rules": [
        ["required"],
        ["string", {"max": 128}]
      ],
      "sortable": true
    },
    {
      "label": "Mechanics",
      "key": "mechanics",
      "type": "checkboxList",
      "transform": "json",
      "visibleInGrid": false,
      "rules": [
        ["safe"]
      ]
    },
    {
      "label": "Cover Image",
      "key": "coverImage",
      "type": "assetConnector",
      "visibleInGrid": false,
      "rules": [
        ["safe"]
      ]
    }
  ]
}
```

The generator will automatically:

- Map field types to appropriate database column types
- Create getters and setters for JSON fields
- Set up relations for fields of type `relationSelect` and `assetConnector`

#### Special Field Types

[](#special-field-types)

- **relationSelect**: Creates a relation to another content type. Requires a `config.ctype` property to specify the target content type.
- **assetConnector**: Creates a relation to the asset content type. This is automatically handled without additional configuration.
- **matrixConnector**: Stored as JSON data for complex structured content.
- **widgetConnector**: Stored as JSON data for connecting widgets to content items.
- Fields with `"transform": "json"`: Automatically handled with getters and setters for working with JSON data.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance94

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 99.4% 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 ~3 days

Recently: every ~9 days

Total

223

Last Release

25d ago

PHP version history (2 changes)0.9.3PHP &gt;=7.4.0

0.18.2PHP &gt;=8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d8b54efbc79683c32645e3fa8d3590037fa003963a16e0ed989104c6f4a2723?d=identicon)[smyr](/maintainers/smyr)

---

Top Contributors

[![smeyerme](https://avatars.githubusercontent.com/u/1925560?v=4)](https://github.com/smeyerme "smeyerme (633 commits)")[![stebach](https://avatars.githubusercontent.com/u/8438121?v=4)](https://github.com/stebach "stebach (3 commits)")[![gitbutler-client](https://avatars.githubusercontent.com/u/132921372?v=4)](https://github.com/gitbutler-client "gitbutler-client (1 commits)")

---

Tags

yii2crelishcmp

### Embed Badge

![Health badge](/badges/giantbits-yii2-crelish/health.svg)

```
[![Health](https://phpackages.com/badges/giantbits-yii2-crelish/health.svg)](https://phpackages.com/packages/giantbits-yii2-crelish)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M576](/packages/shopware-core)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M507](/packages/pimcore-pimcore)

PHPackages © 2026

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