Download the PHP package zaek/framy without Composer
On this page you can find all versions of the php package zaek/framy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package framy
Framy
Simple php framework will be useful for creating provisional endpoints in frontend development.
Start
Create entrypoint for you scripts and define configuration as mentioned in the next part
Routing
You can overwrite default router calling the setRouter
method
Router syntax:
Method
Method must be one of the following:
GET|HEAD|POST|PUT|DELETE|CONNECT|OPTIONS|TRACE|CLI
Skip the method definition mean that URI is accessible by any of knowing methods
Response type
You could specify response type
URI
URI may be static...
...or dynamic
where dynamic group defines with the expression:
Target
Target can be a callback function, an array contains function name, an array with class name and method name (method must be static for class names not object), or an object implements \Zaek\Framy\Action interface
Examples
REST
REST route creates following links:
Route key uses as route key e.g. for /projects is project_id, for /users is user_id etc.
Prefix
For grouping URIs by prefix you can use class RoutePrefix:
RoutePrefix handles as array, so you can group prefixes inside other prefix and combine RoutePrefix with standard route:
Example for versioning:
Proxy
Proxying all responses in group with a callback:
Config
Name | Type | Default Value | Description |
---|---|---|---|
homeDir |
string | $_SERVER['DOCUMENT_ROOT'] |
The root directory of web server |
routes |
array | - | List of routing rules will be applyed |
dataDir |
string | - | The directory where will be store all data (built-in file-based DB) |
useDefault |
bool | true | Use default framework settings (see below in section default setup) |
Default setup
The default functionality provided by Framy will place:
User with the following properties
Status=ok in JSON response
Every action has JSON response will be complete with {status:'ok'} flag
Routes to api
Built-in sign-up action is placed in ./bin directory.
The useDefault
option will add the route to such script.
Built-in API
URI | Method | Params | Return |
---|---|---|---|
/framy/signUp | POST | login password |
{userId:(int)} |