Download the PHP package anpv1/iceage-php without Composer
On this page you can find all versions of the php package anpv1/iceage-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package iceage-php
IceAge - micro php framework
IceAge is a PHP nano-framework which is lightning fast and extreme small with total around 350 lines of code. IceAge provide a very simple, but powerful and flexible interface for building web-based applications.
In my Lenovo U4170, Intel Core i5 5200U, 4GB RAM, using apache bench, a full page using IceAge with dotenv to load environment variables, Twig for template engine and 1 PDO MySQL query can reach 1639.09 requests/second. A hello world page using IceAge can reach up to 10167.46 requests/second.
Hello, world!
Routing
Using Services
IceAge support 2 main features: routes and services management. You can register service to the application using register method:
As you can see in the above example, services can be loaded by its name ($db) or by its class name (Twig_Environment)
Bootstrap application
IceAge application object support a bootstrap method which can use to register all services and routes handler. For example:
Request lifecycle
- The bootstrap functions is call, with instance of IceAge Application object
- The application object will try to find the matched routes
- If no route matched, an IceAge\Exception is throw with the code is IceAge\Exception::NO_ROUTE and exit
- If one route matched, IceAge Application will run the route middlewares if exits.
- If the route middleware handler run and return the response, IceAce Application will move the the output process step without running route handler.
- If the route middleware does not return value, IceAge Application load all services which the route handler used, and then call route handler with loaded services and then get the response.
- Depending on the route handler response:
- If it is a string, IceAge send the string as output to browser immediately.
- If it is an instance of \Psr\Http\Message\ResponseInterface, IceAge use \Zend\Diactoros to produce the output and send to browser.
- In other cases, IceAge use json_encode function to produce the output and send it with header Content-type: application/json.
To register route middleware, you can use middleware method of the route object: