Installation

Requirements

  • CakePHP 3.2+
  • PHP 5.5.9+

Using composer

The recommended installation method for this plugin is by using composer.

composer require friendsofcake/crud:^4.3

You can also check Packagist.

Loading the plugin

Add the following to your /config/bootstrap.php

Plugin::load('Crud');

Configuring the controller

The Crud plugin provides a trait which will catch a MissingActionException and then step in to provide scaffold actions to the controllers.

To enable Crud across your whole application add the trait to your src/Controller/AppController.php

namespace App\Controller;

class AppController extends \Cake\Controller\Controller
{
    use \Crud\Controller\ControllerTrait;

}

Note

To have Crud just scaffold a single controller you can just add the ControllerTrait to that specific controller.

Adding the ControllerTrait itself do not enable anything Crud, but simply installs the code to handle the \Cake\Error\MissingActionException exception so you don’t have to implement an action in your controller for Crud to work.

The next step is to load the Crud component in your controller. A basic example is as follows, and will enable the Crud plugin to scaffold all your controllers index actions.

class AppController extends \Cake\Controller\Controller
{
    use \Crud\Controller\ControllerTrait;

    public function initialize()
    {
        parent::initialize();

        $this->loadComponent('Crud.Crud', [
            'actions' => [
                'Crud.Index'
            ]
        ]);

        // Other application wide controller setup
    }
}

Further configuration options are detailed on the configuration page.

  v: 5.1.2
Versions
latest
stable
5.1.2
5.1.1
5.1.0
5.0.0
4.4.4
4.4.3
4.4.2
4.4.1
4.4.0
4.3.5
4.3.4
4.3.3
4.3.2
4.3.1
4.3.0
4.2.4
v4.0.0
cake3
Downloads
On Read the Docs
Project Home
Builds
Downloads
On GitHub
View
Edit

Free document hosting provided by Read the Docs.