Package Data | |
---|---|
Maintainer Username: | rcrowe |
Maintainer Contact: | hello@vivalacrowe.com (Rob Crowe) |
Package Create Date: | 2013-04-27 |
Package Last Update: | 2014-06-21 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-22 15:02:17 |
Package Statistics | |
---|---|
Total Downloads: | 3,390 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 87 |
Total Watchers: | 7 |
Total Forks: | 6 |
Total Open Issues: | 3 |
Turbolinks but for your PHP application; powered by PJAX.
Turbo has only been tested installing through Composer.
Add rcrowe\turbo
as a requirement to composer.json:
{
"require": {
"rcrowe/turbo": "0.2.*"
}
}
Update your packages with composer update
or install with composer install
.
Providers enable instant usage of Turbo within different frameworks, we currently provide the following integrations:
Laravel
Add Turbo\Provider\Laravel\TurboServiceProvider
to app/config/app.php
and your good to go.
The Laravel provider also registers a turbo.pjax
event so that other parts of your app can listen for a pjax request. For example:
Event::listen('turbo.pjax', function($request, $response) {
$response->header('X-App-Msg', 'Hello world');
});
Fuelphp
Add class_alias('Turbo\\Provider\\Fuel\\Response', 'Response')
to the bottom of fuel\app\bootstrap.php
and your good to go.
Turbo also registers a turbo.pjax
event that you can listen for. For example:
Event::register('turbo.pjax', function() {
echo 'This is a pjax request';
});
To make this all work Turbo needs PJAX to get and set the response.
Just like Turbolinks we respond with the whole body, not just a section of it. In order to support this, you need
to setup PJAX to use the <body>
tag. A simple example of this would be:
$(function() {
$(document).pjax('.js-pjax', 'body');
});
Turbo is released under the MIT public license.