Download the PHP package nddcoder/rest without Composer
On this page you can find all versions of the php package nddcoder/rest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nddcoder/rest
More information about nddcoder/rest
Files in nddcoder/rest
Informations about the package rest
rest-framework
Rest Framework - PHP Framework for ReactPHP Library
Docs
- Installation
- Server Requirements
- Installing Rest
- Local Development Server
- Deploy
- Using Docker
- Using Supervisor
- Usage
- Router
- Dependency Injection
- Singleton
- Resolve an instance from container
- Helpers
Installation
Server Requirements
The Rest framework has a few system requirements.
- PHP >= 7.4
- BCMath PHP Extension
- Ctype PHP Extension
- Fileinfo PHP Extension
- JSON PHP Extension
- Mbstring PHP Extension
- OpenSSL PHP Extension
- PDO PHP Extension
- Tokenizer PHP Extension
- XML PHP Extension
Installing Rest
Rest utilizes Composer to manage its dependencies. So, before using Rest, make sure you have Composer installed on your machine.
Install Rest by issuing the Composer create-project
command in your terminal:
composer create-project --prefer-dist nddcoder/rest blog
Local Development Server
Just run index.php
file
Or, if you have nodemon installed, you can have auto reload feature by using nodemon
Deploy
Using Docker
Just build image based on project's Dockerfile
Using Supervisor
Usage
Router
Rest using Fast Route for routing. Application routes can be register in app/Router.php
.
Controller
The first parameter of controller method always is ServerRequestInterface
, any route params will following this.
Dependency Injection
Bind class to container
Singleton
To make a class is singleton, you can make class implemnt Singleton
interface or bind to container using singleton
method
Resolve an instance from container
Inject dependencies in __construct
function
Using app
helper
Inject dependencies in __construct
function
Helpers
app
: return Application instance or resolve an instance from container
view
: return ViewResponse
instance. Accept view name and optional data need pass to view
response
: return Response
instance, use to build response
env
: get enviroment vairable from $_ENV
. Rest using vlucas/phpdotenv
for load env variables from .env
file.
dd
: var_dump and die
variable for debugging.
abort
: intermediately return http response. Accept status code
and message
abort_if
: abort
based on $condition
abort_unless
: reversed side of abort_if
logger
: log a string or an Throwable
instance to console