Giter VIP home page Giter VIP logo

turbo's Introduction

Turbo

Turbolinks but for your PHP application; powered by PJAX.

Build Status

Installation

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

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';
});

PJAX

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');
});

License

Turbo is released under the MIT public license.

turbo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

turbo's Issues

Call to a member function render() on a non-object

Hi,

I get an error after adding Turbo\Provider\Laravel\TurboServiceProvider to the list of providers.

Symfony\Component\Debug\Exception\FatalErrorException
…\vendor\rcrowe\turbo\src\Turbo\Provider\Laravel\TurboServiceProvider.php31

            $turbo = new Turbo($response->getOriginalContent()->render());

how to use it?

I am new with Turbo.
How to use it?
Please example for me.
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.