Lightweight tool for building simple Rest HTTP/API in PHP programming language environment
version - Beta
composer require anwarachilles/nirvana-native-php
Create an index.php file, then setup environment & rest, like the example below.
Nirvana::environment([
'Configure'=> [
'development'=> true,
'baseurl'=> 'http://localhost/<yourproject>/',
]
]);
Nirvana::rest('GET', 'demo', function() {
return [
'name'=> Nirvana::method('name'),
'code'=> Nirvana::method('code'),
];
});
Properties | Type | Description |
---|---|---|
development |
string |
Optional. will return response with development dataset |
basedir |
__DIR__ |
Required set default baseurl from the project |
baseurl |
string |
Required set default baseurl from the project |
Method & Properties | Type | Description |
---|---|---|
method |
string |
return data on method requested. |
load |
string |
load another Rest. |
data |
string |
(Under Development) |
store |
name |
get data from store can do CRUD |
Method & Properties | Type | Description |
---|---|---|
ifNotFound |
void |
set default 404 not found if request not have Rest. |
store |
name , data array |
set data to store. |
Method & Properties | Type | Description |
---|---|---|
set |
array |
insert/create data to store |
get |
id orvoid |
view/load data from store |
put |
id , array |
update/load data from store |
del |
id |
delete/remove data from store |
find |
field , value orvoid |
view data from store with specified field and value, or only field |