, (*1)
Basic Restler Application
Minimalistic api server boilerplate for Luracast Restler, (*2)
Restler is an api first microframework that offers better web api by design. Every branch in this repository contains
different application templates to suit your needs., (*3)
Basic App provides the bare minimum to get started with restler development, (*4)
Installation
Make sure PHP 5.5 or above (use the latest version of PHP for better performance) is available on your server, (*5)
Composer is used to manage the dependencies. If you don't already have composer installed, we
recommend installing it globally, (*6)
Install Composer
Instructions to install composer globally are available
in getcomposer.org, (*7)
Install Basic Restler Application
You can run the following command on your terminal window to install the app, (*8)
composer create-project restler/application=dev-basic {app_name}
Replace {app_name}
with the name of your application., (*9)
It will create a new folder and place all the needed files to get started., (*10)
Alternatively, since this is a template repository, you can simply generate
your own repository from it!, (*11)
What's in it?
Basic is a minimalistic app templates for api development. It has a sample api class called Home
that has the
following success message for the api root., (*12)
It is advisable to use namespace for the api classes for avoiding name conflicts, here we are using App
as the
namespace, (*13)
{
"success": {
"code": 200,
"message": "Restler is up and running!"
}
}
On your development machine, you can run the development server by running the composer serve
on the project root.
This will run the php development server at port 8000 on localhost by default. If you need to run change that you can
edit your composer.json accordingly., (*14)
This project also comes with swagger ui for testing and documenting the api. You can access that using the following url, (*15)
http://localhost:8000/explorer, (*16)
Next Steps
There is only public api, you may want to add an auth class and add some protected api, (*17)