PHP code example of milan-miscevic / yii2crud

1. Go to this page and download the library: Download milan-miscevic/yii2crud library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

milan-miscevic / yii2crud example snippets


'bootstrap' => [
    // ...
    'yii2crud',
],

'modules' => [
    // ...
    'yii2crud' => [
        'class' => \mmm\yii2crud\Module::class,
        'cruds' => [
            'article',
        ],
        'namespaces' => [
            'form' => 'app\form',
            'models' => 'app\models',
            'service' => 'app\service',
        ],
    ],
],

// form/ArticleForm.php

namespace app\form;

use mmm\yii2crud\CrudForm;

class ArticleForm extends CrudForm
{
    public $title;
    public $content;

    public function rules()
    {
        return [
            [['title', 'content'], '

// models/Article.php

namespace app\models;

use mmm\yii2crud\CrudActiveRecord;

class Article extends CrudActiveRecord
{
}