Download the PHP package blast/turbine without Composer
On this page you can find all versions of the php package blast/turbine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download blast/turbine
More information about blast/turbine
Files in blast/turbine
Package turbine
Short Description PSR-7 Micro PHP framework
License MIT
Homepage https://github.com/Hawkbit
Informations about the package turbine
Hawkbit\Application
Hawkbit\Application micro framework is a high customizable, event driven and compatible with PSR-7, StackPHP and Zend Stratigility.
Hawkbit\Application uses latest versions of League\Route for routing, League\Container for dependency injection, League\Event for event dispatching, Zend Config for configuration.
Hawkbit\Application is an advanced derivate of Proton and part of Hawkbit\Application Component collection by Marco Bunge. Hawkbit\Application 1.x is also known as Blast Hawkbit\Application.
Quick start
Please see public/ for example usage and read documentation.
Integrations
Hawkbit\Application delivers also optional packages:
- Database:
hawkbit/database
- Doctrine ORM Wrapper:
hawkbit/doctrine
- Plates View Engine:
hawkbit/presentation
Motivation
My vision is to provide a micro framework which is able to handle HTTP and CLI in the same fashion. The developer should be able to reuse it's code, design it's business layer by his needs. Hawkbit should be a supporting tool instead of predefined framework. And yes it is under active development.
I love PSR, phpleague und a minimal set of dependecies and want to create a micro framework which is used the best packages out there and bundeld in a nice application layer. I'm also love the style of component-based development.
Hawkbit is built on top phpleague packages and keep PSR in mind. Hawkbit is designed to co-exist whith your code instead of replace code base. Hawkbit does has a small dependency footprint. Last but not least Hawkbit does not force the developer how to design the application bussiness logic, since we prefer to use POPO's for Controllers / Commands (the accessor to bussiness logic).
At the moment I design and develop all Hawkbit packages and manage the whole codebase. I would be appreciate for support or even better: for contributors!
Please refer to Issue #33 for details.
Special thanks
Thank you for PR, identifing Bus, or any other Improvements!
Install
Using Composer
Hawkbit\Application is available on Packagist and can be installed using Composer. This can be done by running the following command or by updating your composer.json
file.
composer.json
Be sure to also include your Composer autoload file in your project:
Downloading .zip file
This project is also available for download as a .zip
file on GitHub. Visit the releases page, select the version you want, and click the "Source code (zip)" download button.
Requirements
The following versions of PHP are supported by this version.
- PHP 5.5
- PHP 5.6
- PHP 7.0
- PHP 7.1
- HHVM
Setup
Create a new app
Create a new app with configuration
Add routes
Run application
See also our example at /public/index.php
.
Configuration
Add additional configuration to application
Hawkbit\Application Configuration is managed by zend-config.
Access configuration
Middlewares
Hawkbit\Application middlewares allows advanced control of lifecycle execution.
Hawkbit\Application uses it's own runner Hawkbit\Application\MiddelwareRunner
Routing
Hawkbit\Application uses routing integration of league/route
and allows access to route collection methods directly.
Basic usage with anonymous functions:
Access app from anonymous function
Hawkbit\Application allows to access itself from anonymous function through closure binding.
Basic usage with controllers:
Automatic constructor injection of controllers:
Please use boot method in Service Providers for correct injection of services into controller!
For more information about routes read this guide
Route groups
Hawkbit\Application add support for route groups.
Available vars
$route
-\League\Route\RouteGroup
$this
-\Hawkbit\Application
Middleware integrations
StackPHP
Basic usage with StackPHP (using Stack\Builder
and Stack\Run
):
Zend Stratigility
Basic usage with Stratigility (using Zend\Stratigility\MiddlewarePipe
):
Error handling
Hawkbit\Application uses Whoops error handling framework and determines the error handler by request content type.
Set your own handler:
By default Hawkbit\Application runs with error options disabled. To enable debugging add
By default Hawkbit\Application is catching all errors. To disable error catching add
Console
The console application inherit all methods from Http Application except routing and PSR-7 handling and capturing. In addition to http application, the console application does not support all events (Refer to events for more information!)
Logging
Hawkbit\Application has built in support for Monolog. To access a channel call:
For more information about channels read this guide - https://github.com/Seldaek/monolog/blob/master/doc/usage.md#leveraging-channels.
Events
You can intercept requests and responses at seven points during the lifecycle. You can manipulate Request, Response and
ErrorResponse via Hawkbit\ApplicationEvent
.
Application event
request.received
This event is fired when a request is received but before it has been processed by the router.
response.created
Not available for Console applications!
This event is fired when a response has been created but before it has been output.
response.sent
Not available for Console applications! Please use shutdown
This event is fired when a response has been output and before the application lifecycle is completed. Not available for Console Applications!
runtime.error
This event is always fired when an error occurs.
lifecycle.error
Not available for Console applications! Please use runtime.error
$errorResponse
is used as default response
This event is fired only when an error occurs while handling request/response lifecycle. This event is fired after runtime.error
lifecycle.complete
Not available for Console applications! Please use shutdown
This event is fired when a response has been output and before the application lifecycle is completed.
shutdown
This event is always fired after each operation is completed or failed.
Custom Events
You can fire custom events using the event emitter directly:
Dependency Injection Container
Hawkbit\Application uses League/Container
as its dependency injection container.
You can bind singleton objects into the container from the main application object using ArrayAccess:
or by container access:
Multitons can be added using the add
method on the container:
Service providers can be registered using the register
method on the Hawkbit\Application app or addServiceProvider
on the container:
For more information about service providers check out this page - http://container.thephpleague.com/service-providers/.
For easy testing down the road it is recommended you embrace constructor injection:
Container
Set your own container needs an instance of \League\Container\ContainerInterface
Get container
Services
Hawkbit\Application uses dependency injection container to access services. Following integrations can be exchanged.
Configurator
Uses in Application::setConfig()
,Application::getConfig()
and Application::hasConfig()
error handler
error response handler
psr logger
Get a new logger instance by channel name
Get a list of available logger channels
psr server request
psr response
response emitter
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Marco Bunge
- Alex Bilbie (Proton)
- All contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of turbine with dependencies
filp/whoops Version ^2.1
league/route Version ~3.0
league/container Version ^2.4
league/event Version ^2.1
league/climate Version ^3.2
monolog/monolog Version ^1.22
zendframework/zend-config Version ^2.6
zendframework/zend-diactoros Version ^1.4