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

Recommend this page to a friend!
  Info   View files Documentation   View files View files (23)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2020-09-11 (20 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 52 This week: 3All time: 9,863 This week: 83Up
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: 17 packages by
Country: Russian Federation Russian Federation
Age: ???
All time rank: 309583 in Russian Federation Russian Federation
Week rank: 13 Up2 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 2x

Details

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  
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  /  res  
File Role Description
Files folder imagetemplates (1 file)

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

  Files folder image Files  /  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  /  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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:52
This week:3
All time:9,863
This week:83Up

For more information send a message to info at phpclasses dot org.