Recommend this page to a friend! |
Single file PHP script that adds a REST API to a MySQL database.
- PHP 7.0 or higher with PDO drivers enabled for one of these database systems: - MySQL 5.6 / MariaDB 10.0 or higher for spatial features in MySQL
Edit the following lines in the bottom of the file "login.php
" and "Item.php
":
$vt = $this->Database(
"Database",
"localhost",
"stable",
"root",
""
);
The following features are supported:
- JWT installment - ElastichSearch V2
The example login table has only a a few fields:
post
=======
/login
/login/all
/login/single
/login/register
/login/update
/login/delete
The CRUD + List operations below act on this table.
To read a record from this table the request can be written in URL format as:
POST /login
Headers
Content-Type : application/json
Body-raw / Json request
{
"email" : "deneme@gmail.com",
"password" : "123456",
"apikey" : "12"
}
Where "1" is the value of the primary key of the record that you want to read. It will return:
{
"status":1,
"jwt":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJsb2NhbGhvc3QiLCJpYXQiOjE2NDY5NDE2MjMsIm5iZiI6MTY0Njk0MTYzMywiZXhwIjoxNjQ2OTQ1MjIzLCJhdWQiOiJteWxvZ2luIiwiZGF0YSI6eyJpZCI6IjEiLCJlbWFpbCI6ImRlbmVtZUBnbWFpbC5jb20iLCJteWFwaWtleSI6IjEyIn19.5ZFqcYSADVaG0BoFBNtxl5nfjCR7d3Wn8JZ0ra-PcJ8","message":"Succesful"
}
On login operations.
To read a record from this table the request can be written in URL format as:
POST /login/register
Headers
Content-Type : application/json
Authorization : Login JWt
Body-raw / Json request
{
"email":"example@example.com",
"password":"123456",
"apikey":"555",
"status":"1",
"myapi":"12",
"secret":"stableDeneme"
}
Where "1" is the value of the primary key of the record that you want to read. It will return:
{
"status":1,
"message":"Succesful"
}
On create operations.
To read a record from this table the request can be written in URL format as:
POST /login/single
Headers
Content-Type : application/json
Authorization : Login JWT
Body-raw / Json request
{
"id" : "11",
"myapi" : "12",
"secret" : "stableDeneme"
}
Where "1" is the value of the primary key of the record that you want to read. It will return:
{
"status":1,
"data":{
"login_id":"11",
"login_email":"example@example.com",
"login_pass":"7c4a8d09ca3762af61e59520943dc26494f8941b",
"login_apikey":"555",
"login_status":"1"
},
"message":"Succesful"
}
On single read operations.
To read a record from this table the request can be written in URL format as:
POST /login/all
Headers
Content-Type : application/json
Authorization : Login JWT
Body-raw / Json request
{
"myapi" : "12",
"secret" : "stableDeneme"
}
Where "1" is the value of the primary key of the record that you want to read. It will return:
{
"status": 1,
"data": [
{
"login_id": "1",
"login_email": "deneme@gmail.com",
"login_pass": "7c4a8d09ca3762af61e59520943dc26494f8941b",
"login_apikey": "12",
"login_status": "1"
},
{
"login_id": "10",
"login_email": "tamamd?r@gmail",
"login_pass": "7c4a8d09ca3762af61e59520943dc26494f8941b",
"login_apikey": "998",
"login_status": "1"
},
{
"login_id": "11",
"login_email": "example@example.com",
"login_pass": "7c4a8d09ca3762af61e59520943dc26494f8941b",
"login_apikey": "555",
"login_status": "1"
}
],
"message": "Succesful"
}
On read operations.
To read a record from this table the request can be written in URL format as:
POST /login/update
Headers
Content-Type : application/json
Authorization : Login JWT
Body-raw / Json request
{
"id": "11",
"email": "example@example.com",
"password": "555666777",
"apikey": "555",
"status": "1",
"myapi":"12",
"secret":"stableDeneme"
}
Where "1" is the value of the primary key of the record that you want to read. It will return:
{
"status": 1,
"message": "Succesful"
}
On update operations.
To read a record from this table the request can be written in URL format as:
POST /login/delete
Headers
Content-Type : application/json
Authorization : Login JWT
Body-raw / Json request
{
"id" : "10",
"myapi" : "12",
"secret" : "stableDeneme"
}
Where "1" is the value of the primary key of the record that you want to read. It will return:
{
"status": 1,
"message": "Succesful"
}
On delete operations.
Classes of Hicri | > | PHP MySQL REST API Generator | > | Download .zip .tar.gz | > | Support forum | > | Blog | > | Latest changes |
|
Groups | Applications | Files |
Groups |
PHP 5 | Classes using PHP 5 specific features | View top rated classes |
Databases | Database management, accessing and searching | View top rated classes |
Web services | Web data clipping, SOAP or XML-RPC clients and servers | View top rated classes |
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.
Files | / | restAPI |
File | Role | Description | ||
---|---|---|---|---|
Controllers (2 files) | ||||
helpers (1 file) | ||||
jwt (2 files, 1 directory) | ||||
models (3 files) | ||||
vendor (1 file, 2 directories) | ||||
views (10 files) | ||||
.htaccess | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
Control.php | Class | Class source | ||
index.php | Example | Example script |
Files | / | restAPI | / | jwt |
File | Role | Description | ||
---|---|---|---|---|
vendor (1 file, 2 directories) | ||||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data |
Files | / | restAPI | / | jwt | / | vendor |
File | Role | Description | ||
---|---|---|---|---|
composer (11 files) | ||||
firebase (1 directory) | ||||
autoload.php | Aux. | Auxiliary script |
Files | / | restAPI | / | jwt | / | vendor | / | composer |
File | Role | Description |
---|---|---|
autoload_classmap.php | Aux. | Auxiliary script |
autoload_namespaces.php | Aux. | Auxiliary script |
autoload_psr4.php | Aux. | Auxiliary script |
autoload_real.php | Class | Class source |
autoload_static.php | Class | Class source |
ClassLoader.php | Class | Class source |
installed.json | Data | Auxiliary data |
installed.php | Aux. | Auxiliary script |
InstalledVersions.php | Class | Class source |
LICENSE | Lic. | License text |
platform_check.php | Aux. | Auxiliary script |
Files | / | restAPI | / | jwt | / | vendor | / | firebase | / | php-jwt |
File | Role | Description | ||
---|---|---|---|---|
src (5 files) | ||||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation |
Files | / | restAPI | / | jwt | / | vendor | / | firebase | / | php-jwt | / | src |
File | Role | Description |
---|---|---|
BeforeValidException.php | Class | Class source |
ExpiredException.php | Class | Class source |
JWK.php | Class | Class source |
JWT.php | Class | Class source |
SignatureInvalidException.php | Class | Class source |
Files | / | restAPI | / | models |
File | Role | Description |
---|---|---|
Database.php | Class | Class source |
itemmodel.php | Class | Class source |
usermodel.php | Class | Class source |
Files | / | restAPI | / | vendor |
File | Role | Description | ||
---|---|---|---|---|
bramus (1 directory) | ||||
composer (11 files) | ||||
autoload.php | Aux. | Auxiliary script |
Files | / | restAPI | / | vendor | / | bramus | / | router |
File | Role | Description | ||
---|---|---|---|---|
demo-multilang (2 files) | ||||
demo (2 files) | ||||
src (1 directory) | ||||
tests (2 files) | ||||
.php_cs.dist | Example | Example script | ||
.travis.yml | Data | Auxiliary data | ||
CHANGELOG.md | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
phpunit.xml.dist | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files | / | restAPI | / | vendor | / | bramus | / | router | / | src | / | Bramus | / | Router |
File | Role | Description |
---|---|---|
Router.php | Class | Class source |
Files | / | restAPI | / | vendor | / | bramus | / | router | / | tests |
File | Role | Description |
---|---|---|
bootstrap.php | Aux. | Auxiliary script |
RouterTest.php | Class | Class source |
Files | / | restAPI | / | vendor | / | composer |
File | Role | Description |
---|---|---|
autoload_classmap.php | Aux. | Auxiliary script |
autoload_namespaces.php | Aux. | Auxiliary script |
autoload_psr4.php | Aux. | Auxiliary script |
autoload_real.php | Class | Class source |
autoload_static.php | Class | Class source |
ClassLoader.php | Class | Class source |
installed.json | Data | Auxiliary data |
installed.php | Aux. | Auxiliary script |
InstalledVersions.php | Class | Class source |
LICENSE | Lic. | License text |
platform_check.php | Aux. | Auxiliary script |
Files | / | restAPI | / | views |
File | Role | Description |
---|---|---|
item-create.php | Aux. | Auxiliary script |
item-delete.php | Aux. | Auxiliary script |
item-single.php | Aux. | Auxiliary script |
item-update.php | Aux. | Auxiliary script |
login-create.php | Aux. | Auxiliary script |
login-delete.php | Aux. | Auxiliary script |
login-list.php | Aux. | Auxiliary script |
login-single.php | Aux. | Auxiliary script |
login-update.php | Aux. | Auxiliary script |
login.php | Aux. | Auxiliary script |
Install with Composer - Download all files: php-rest-api.tar.gz php-rest-api.zip NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
|
Files | / | restAPI |
File | Role | Description | ||
---|---|---|---|---|
Controllers (2 files) | ||||
helpers (1 file) | ||||
jwt (2 files, 1 directory) | ||||
models (3 files) | ||||
vendor (1 file, 2 directories) | ||||
views (10 files) | ||||
.htaccess | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
Control.php | Class | Class source | ||
index.php | Example | Example script |
Files | / | restAPI | / | jwt |
File | Role | Description | ||
---|---|---|---|---|
vendor (1 file, 2 directories) | ||||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data |
Files | / | restAPI | / | jwt | / | vendor |
File | Role | Description | ||
---|---|---|---|---|
composer (11 files) | ||||
firebase (1 directory) | ||||
autoload.php | Aux. | Auxiliary script |
Files | / | restAPI | / | jwt | / | vendor | / | composer |
File | Role | Description |
---|---|---|
autoload_classmap.php | Aux. | Auxiliary script |
autoload_namespaces.php | Aux. | Auxiliary script |
autoload_psr4.php | Aux. | Auxiliary script |
autoload_real.php | Class | Class source |
autoload_static.php | Class | Class source |
ClassLoader.php | Class | Class source |
installed.json | Data | Auxiliary data |
installed.php | Aux. | Auxiliary script |
InstalledVersions.php | Class | Class source |
LICENSE | Lic. | License text |
platform_check.php | Aux. | Auxiliary script |
Files | / | restAPI | / | jwt | / | vendor | / | firebase | / | php-jwt |
File | Role | Description | ||
---|---|---|---|---|
src (5 files) | ||||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation |
Files | / | restAPI | / | jwt | / | vendor | / | firebase | / | php-jwt | / | src |
File | Role | Description |
---|---|---|
BeforeValidException.php | Class | Class source |
ExpiredException.php | Class | Class source |
JWK.php | Class | Class source |
JWT.php | Class | Class source |
SignatureInvalidException.php | Class | Class source |
Files | / | restAPI | / | models |
File | Role | Description |
---|---|---|
Database.php | Class | Class source |
itemmodel.php | Class | Class source |
usermodel.php | Class | Class source |
Files | / | restAPI | / | vendor |
File | Role | Description | ||
---|---|---|---|---|
bramus (1 directory) | ||||
composer (11 files) | ||||
autoload.php | Aux. | Auxiliary script |
Files | / | restAPI | / | vendor | / | bramus | / | router |
File | Role | Description | ||
---|---|---|---|---|
demo-multilang (2 files) | ||||
demo (2 files) | ||||
src (1 directory) | ||||
tests (2 files) | ||||
.php_cs.dist | Example | Example script | ||
.travis.yml | Data | Auxiliary data | ||
CHANGELOG.md | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
phpunit.xml.dist | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files | / | restAPI | / | vendor | / | bramus | / | router | / | src | / | Bramus | / | Router |
File | Role | Description |
---|---|---|
Router.php | Class | Class source |
Files | / | restAPI | / | vendor | / | bramus | / | router | / | tests |
File | Role | Description |
---|---|---|
bootstrap.php | Aux. | Auxiliary script |
RouterTest.php | Class | Class source |
Files | / | restAPI | / | vendor | / | composer |
File | Role | Description |
---|---|---|
autoload_classmap.php | Aux. | Auxiliary script |
autoload_namespaces.php | Aux. | Auxiliary script |
autoload_psr4.php | Aux. | Auxiliary script |
autoload_real.php | Class | Class source |
autoload_static.php | Class | Class source |
ClassLoader.php | Class | Class source |
installed.json | Data | Auxiliary data |
installed.php | Aux. | Auxiliary script |
InstalledVersions.php | Class | Class source |
LICENSE | Lic. | License text |
platform_check.php | Aux. | Auxiliary script |
Files | / | restAPI | / | views |
File | Role | Description |
---|---|---|
item-create.php | Aux. | Auxiliary script |
item-delete.php | Aux. | Auxiliary script |
item-single.php | Aux. | Auxiliary script |
item-update.php | Aux. | Auxiliary script |
login-create.php | Aux. | Auxiliary script |
login-delete.php | Aux. | Auxiliary script |
login-list.php | Aux. | Auxiliary script |
login-single.php | Aux. | Auxiliary script |
login-update.php | Aux. | Auxiliary script |
login.php | Aux. | Auxiliary script |
Install with Composer - Download all files: php-rest-api.tar.gz php-rest-api.zip NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
|