PHP code example of t4web / crud
1. Go to this page and download the library: Download t4web/crud 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/ */
t4web / crud example snippets
return array(
'modules' => array(
// ...
'T4web\Crud',
),
// ...
);
'route-generation' => [
[
'entity' => 'user',
'backend' => [
'namespace' => '/backend',
'actions' => [
'new',
'create',
'read',
'update',
'delete',
'list',
],
'options' => [
'create' => [
'changesValidator' => Action\Admin\User\CreateAction\ChangesValidator::class,
'controller' => Action\Admin\User\CreateAction\Controller::class,
'allowedMethods' => ['POST'],
'service' => 'user-crud-delete-service',
'redirectTo' => 'admin-user-list',
],
'update' => [
'changesValidator' => Action\Admin\User\CreateAction\ChangesValidator::class,
],
],
],
],
],
'routes' => [
'admin-user-new' => [
'type' => 'Segment',
'options' => [
'route' => '/backend/user/new',
'defaults' => [
'allowedMethods' => ['GET'],
'controller' => 'sebaks-zend-mvc-controller',
],
],
],
'admin-user-create' => [
'type' => 'Segment',
'options' => [
'route' => '/backend/user/create',
'defaults' => [
'allowedMethods' => ['POST'],
'controller' => 'Users\Action\Admin\User\CreateAction\Controller',
'service' => 'user-crud-create-service',
'redirectTo' => 'admin-user-list',
'changesValidator' => 'Users\Action\Admin\User\CreateAction\ChangesValidator',
],
],
],
'admin-user-read' => [
'type' => 'Segment',
'options' => [
'route' => '/backend/user/read/:id',
'defaults' => [
'allowedMethods' => ['GET'],
'controller' => 'sebaks-zend-mvc-controller',
'routeCriteria' => 'id',
'service' => 'user-crud-read-service',
'criteriaValidator' => 'user-crud-id-validator',
],
],
],
'admin-user-update' => [
'type' => 'Segment',
'options' => [
'route' => '/backend/user/update/:id',
'defaults' => [
'allowedMethods' => ['POST'],
'controller' => 'sebaks-zend-mvc-controller',
'routeCriteria' => 'id',
'criteriaValidator' => 'user-crud-id-validator'
'service' => 'user-crud-update-service',
'redirectTo' => 'admin-user-list',
],
],
],
'admin-user-delete' => [
'type' => 'Segment',
'options' => [
'route' => '/backend/user/delete/:id',
'defaults' => [
'allowedMethods' => ['GET'],
'controller' => 'sebaks-zend-mvc-controller',
'routeCriteria' => 'id',
'criteriaValidator' => 'user-crud-id-validator'
'service' => 'user-crud-delete-service',
'redirectTo' => 'admin-user-list',
],
],
],
]
bash
$ php composer.phar update