Download the PHP package enicore/ravenapi without Composer
On this page you can find all versions of the php package enicore/ravenapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package ravenapi
Raven API Framework
Raven API is a lightweight PHP framework for building APIs quickly and efficiently. It provides essential tools for handling requests, managing sessions, interacting with databases, routing, and more, all wrapped in a modular structure ideal for API development.
Installation
To copy from a local directory, add the following configuration in your composer.json:
Usage
In , initialize the program:
Directory structure
Classes will be auto-loaded according to their namespaces relative to . For example:
Routing
The requests will be routed to controllers based on the POST or GET values: "controller" and "action". For example:
Controllers will be loaded from the namespace. Their class names must be suffixed with , and the action methods must be suffixed with . For example:
Parameters can be obtained by using the class, for example:
The controller action should return an array of parameters that will be passed back to the frontend:
The above result will be returned as:
You can also use the class to send the same response:
To send an error response, use the method (with optional data that can be passed as the second parameter):
Error responses are returned with header 200 just like successful responses, but with the "success" parameter set to false. The above response will be returned as:
Authentication
By default, all routes require authentication. To allow access to a route without authentication, add the annotation to the method:
Dependency Injection
To use dependency injection in your classes, use the trait:
This will make all the framework singletons directly available in the class. The injected classes will be created on first access. Controllers inheriting from and Models inheriting from already use the trait.
Injection is done using the magic method. If your class already uses this method for other purposes, you can inject the dependencies manually calling in the constructor of the class. In this case, all the dependencies will be created right away.
To access the dependencies directly, use their method, for example:
License
Raven API is licensed under the MIT License. See LICENSE for more information.
All versions of ravenapi with dependencies
ext-pdo Version *
ext-openssl Version *
ext-zlib Version *
ext-fileinfo Version *
ext-gd Version *
ext-intl Version *
enshrined/svg-sanitize Version ^0.15.4