Download the PHP package pklink/hahns without Composer
On this page you can find all versions of the php package pklink/hahns. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package hahns
Hahns

Hahns is a micro framework for PHP 5.4 and higher.
- Detailed documentation in English (work in progess)
- Detailed documentation in German (work in progess)
Installation
To install using composer, have the following lines in your composer.json
file.
Usage
Create application
Every GET-request to /
will respond
Every DELETE-request to /
will respond
Debug mode
For enable debugging set debug
in the configuration to true
Parameters for routing callback
Hahns will set parameters based on the required type automatically
The following types are built-in:
\Hahns\Hahns
\Hahns\Request
\Hahns\Response\Html
\Hahns\Response\Json
\Hahns\Response\Text
Add your own parameter
The callback for parameter()
must be return an instance of the given type.
Named Parameters
Based on regular expressions
Named Routes
All GET_request to /route1
, /route2
or /route3
respond
Services
Every GET-request to /service-test
will respond
Built-in services are:
html-response
returns instance of\Hahns\Response\Html
json-response
returns instance of\Hahns\Response\Json
text-response
returns instance of\Hahns\Response\Text
Events
Hahns trigger various events. Use the on
-method to add your own handler.
Not Found (404)
Arguments are:
string $usedRoute
\Hahns\Hahns $app
\Hahns\Exception\NotFoundException $e
Per default Hahns sends status code 404
Trigger a "Not Found" event
Simply throw a \Hahns\Exception\NotFoundException
Error
Arguments are:
\Exception $e
\Hahns\Hahns $app
Per default Hahns sends status code 500
Trigger an "Error" event
Simply throw a \Hahns\Exception\ErrorException
Before Running
Arguments are:
string $givenRoute
\Hahns\Hahns $app
After Running
Arguments are:
string $usedRoute
\Hahns\Hahns $app
Before Routing
Arguments are:
string $usedRoute
\Hahns\Hahns $app
After Routing
Arguments are:
string $usedRoute
\Hahns\Hahns $app
Before execute matched route
Arguments are:
string $usedRoute
\Closure $routeCallback
array $argsForCallback
\Hahns\Hahns $app
After execute matched route
Arguments are:
string $usedRoute
\Closure $routeCallback
array $argsForCallback
\Hahns\Hahns $app