Skip to content

AnwarAchilles/nirvana-native-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

24 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Nirvana PHP

Lightweight tool for building simple Rest HTTP/API in PHP programming language environment

version - Beta

Example Use

Install with composer

composer require anwarachilles/nirvana-native-php

PHP structure

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'),
  ];
});

API Reference

Environment configure

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

Nirvana inside Rest

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

Nirvana outside Rest

Method & Properties Type Description
ifNotFound void set default 404 not found if request not have Rest.
store name, data array set data to store.

Special handler store

Method & Properties Type Description
set array insert/create data to store
get idorvoid view/load data from store
put id, array update/load data from store
del id delete/remove data from store
find field, valueorvoid view data from store with specified field and value, or only field

portfolio

About

๐Ÿš€ Lightweight & simple PHP Rest Http

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages