PHP Classes

Mezon PHP CRUD Generator Service: Generate Web service that performs CRUD operations

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 73 All time: 10,228 This week: 74Up
Version License PHP version Categories
mezon-crud-service 1.0.0MIT/X Consortium ...5PHP 5, Databases, Web services, Desig...
Description 

Author

This package can generate Web service that performs CRUD operations.

It provides a base class that applications should extend to create Web service that can perform create, read, update and delete operations on a given database table.

Implementation classes should just pass to the base class the table and field names so the it can handle the Web service requests to perform the CRUD operations.

Picture of Alexey Dodonov
  Performance   Level  
Name: Alexey Dodonov <contact>
Classes: 58 packages by
Country: Russian Federation Russian Federation
Age: ???
All time rank: 184954 in Russian Federation Russian Federation
Week rank: 206 Up13 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 13x

Documentation

Set of classes for creating CRUD services Build Status codecov

Installation

Just print in console

composer require mezon/crud-service

And that's all )

First steps

Now we are ready to create out first CRUD service. Here it is:


/
 * Service class
 */
class TodoService extends \Mezon\CrudService\CrudService
{

    /
     * Constructor
     */
    public function __construct()
    {
        parent::__construct([
            'fields' => [
                'id' => [
                    'type' => 'integer'
                ],
                'title' => [
                    'type' => 'string'
                ]
            ],
            'table-name' => 'records',
            'entity-name' => 'record'
        ]);
    }
}

$service = new TodoService();
$service->run();

The main part of this listing is:

parent::__construct([
	'fields' => [
		'id' => [
			'type' => 'integer'
		],
		'title' => [
			'type' => 'string'
		]
	],
	'table-name' => 'records',
	'entity-name' => 'record'
]);

Here we describe a list of fields of our entity, table name where it is stored and entity name.

Default endpoints

Out of the box a list of CRUD endpoints are available:

GET /list/
GET /all/ 
GET /exact/list/[il:ids]/
GET /exact/[i:id]/
GET /fields/
POST|PUT /delete/[i:id]/
POST|DELETE  /delete/
POST|PUT /create/
POST /update/[i:id]/
GET /new/from/[s:date]/
GET /records/count/
GET /last/[i:count]/
GET /records/count/[s:field]

  Files folder image Files (23)  
File Role Description
Files folder imageres (1 directory)
Files folder imageTests (6 files, 1 directory)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Plain text file CrudService.php Class Class source
Plain text file CrudServiceLogic.php Class Class source
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (23)  /  res  
File Role Description
Files folder imagetemplates (1 file)

  Files folder image Files (23)  /  res  /  templates  
File Role Description
  Accessible without login Plain text file UpdatingForm.tpl Data Auxiliary data

  Files folder image Files (23)  /  Tests  
File Role Description
Files folder imageconf (9 files)
  Plain text file CrudServiceLogicTestsTrait.php Class Class source
  Plain text file CrudServiceLogicUnitTest.php Class Class source
  Plain text file CrudServiceLogicUnitTests.php Class Class source
  Plain text file CrudServiceTests.php Class Class source
  Plain text file CrudServiceUnitTest.php Class Class source
  Plain text file CrudServiceUnitTests.php Class Class source

  Files folder image Files (23)  /  Tests  /  conf  
File Role Description
  Accessible without login Plain text file CrudServiceUnitTestsSetup.json Data Auxiliary data
  Accessible without login Plain text file fields.json Data Auxiliary data
  Accessible without login Plain text file GetDomainIdCrossDomainDisabled.json Data Auxiliary data
  Accessible without login Plain text file GetSimpleRecords.json Data Auxiliary data
  Accessible without login Plain text file InsertBasicFields.json Data Auxiliary data
  Accessible without login Plain text file NoCreationDate.json Data Auxiliary data
  Accessible without login Plain text file Setup.json Data Auxiliary data
  Accessible without login Plain text file SetupCrudServiceNoFieldsUnitTests.json Data Auxiliary data
  Accessible without login Plain text file SetupCrudServiceUnitTests.json Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:73
This week:0
All time:10,228
This week:74Up