Download the PHP package helllomatt/aspen without Composer
On this page you can find all versions of the php package helllomatt/aspen. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download helllomatt/aspen
More information about helllomatt/aspen
Files in helllomatt/aspen
Informations about the package aspen
ASPEN
Aspen is and API manager and router. Make a request, and it will handle where to go for processing and returning information.
Installing
Setting up
You need to create an index file for your project. This will load your config file and also the api endpoints you would like to use.
index.php
If you're using Apache, a .htaccess
file is required for clean routing.
.htaccess
If you're using Nginx, you need to modify your site configuration.
[todo]
Creating endpoints
Modules, plugins, addons, or whatever you call them are the separated endpoints to your API. When you define the modules to load in the index file you created above, everything there is an absolute path. The modules/
folder is just a suggestion, you can organize it however you want.
Create the modules/
folder then inside of there create a sample/
folder, leaving the full path to [ROOT]/modules/sample/
.
There's a required file for an API called controller.php
. That does what you think it does, controls the routing.
controller.php
Create the API object, which is just that. Then set the version. The version is important for when an endpoint is called, the version is looked at. (e.g. localhost/some-api/v1/get
is different than localhost/some-api/v2/get
)
Then you create your endpoints, or places that can be accessed.
Lastly and most importantly you need to return the API object out of the file. An example of the innerworkings for this are $api = (include 'controller.php');
. That lets ASPEN access the API object and work with it when routing.