Recommend this page to a friend! |
Download |
Info | Example | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
67% | Total: 979 This week: 1 | All time: 3,713 This week: 34 |
Version | License | PHP version | Categories | |||
rest-api-with-mysqli 1.1 | Freeware | 5 | PHP 5, Databases, Web services |
Collaborate with this project | Author | |
REST-API-with-MySQLi-and-CRUD-operation - github.com Description This class can be used to implement a REST API server with MySQLi based CRUD operations. Innovation Award |
What is the best PHP api creation class?
i need to create api to be executed in multiple devices
<?php |
Rest API class with MySQLi based CRUD operations and User Module as demo.
Bharat Parmar
1.0
1) config.php : Configuration File
2) bharatcode.sql : Database File.
3) class/Main.class.php : Main class file which contains many usefull methods for database operations, mail sending, validation.
4) rest/.htaccess : HTACCESS file for the URL redirection
5) rest/Rest.inc.php : This class file contains REST Standard basis api related methods.
1) PHP Version : 3.0 and above
Sample Code :
1) Get Users :
Request :
GET /bharat/restful/rest/users HTTP/1.1 Host: localhost Cache-Control: no-cache Postman-Token: 94ce58e8-5db7-4df4-19e5-457b29586d5f
2) Register User :
Request :
POST /bharat/restful/rest/register HTTP/1.1 Host: localhost Cache-Control: no-cache Postman-Token: ec8d2516-818d-4f3d-a417-9903575ccf81 Content-Type: application/x-www-form-urlencoded
Parameters : firstname, lastname, email, password firstname=Jack&email=jackthomas@gmail.com&lastname=Thomas&password=123456
Response :
{ "status": "success", "message": "register successfully.", "data": {
"user_id": 11
} }
3) Delete User :
Request :
DELETE /bharat/restful/rest/deleteuser?id=11 HTTP/1.1 Host: localhost Cache-Control: no-cache Postman-Token: 79e1e8cb-60a8-993a-7e63-d2831ed9ac16 Content-Type: multipart/form-data;
Response :
{ "status": "success", "message": "Total 1 record(s) Deleted.", "data": 1 }
4) Login :
Request :
POST /bharat/restful/rest/login HTTP/1.1 Host: localhost Cache-Control: no-cache Postman-Token: 651c7ef3-da80-0624-f519-b4ca8d39e8f5 Content-Type: application/x-www-form-urlencoded
Parameters : email, password email=jackthomasgmail.com&password=123456
Response :
{ "status": "success", "message": "logged in successfully.", "data": {
"user_id": 11
} }
Files (7) |
File | Role | Description | ||
---|---|---|---|---|
class (1 file) | ||||
rest (3 files) | ||||
bharatcode.sql | Data | Database File | ||
config.php | Conf. | Configuration file | ||
README.md | Doc. | Read Me file |
Files (7) | / | class |
File | Role | Description |
---|---|---|
Main.class.php | Class | Main class file which includes CRUD methods |
Files (7) | / | rest |
File | Role | Description |
---|---|---|
.htaccess | Data | htaccess file for rest |
api.php | Example | REST API methods |
Rest.inc.php | Class | REST class |
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 |
rest-api-with-mysqli-2016-04-21.zip 10KB | |
rest-api-with-mysqli-2016-04-21.tar.gz 9KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Ratings | ||||||||||||||||||||||||||||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.