frenzyapp / turbolinks by TortueTorche

Frenzy Turbolinks makes following links in your web application faster with Laravel 5
22,489
163
7
Package Data
Maintainer Username: TortueTorche
Maintainer Contact: info@studiofrenetic.com (Studio Frénétic)
Package Create Date: 2014-01-29
Package Last Update: 2020-12-07
Language: PHP
License: MIT
Last Refreshed: 2024-11-28 15:00:40
Package Statistics
Total Downloads: 22,489
Monthly Downloads: 73
Daily Downloads: 5
Total Stars: 163
Total Watchers: 7
Total Forks: 13
Total Open Issues: 3

Frenzy Turbolinks for Laravel 5.1+

Frenzy Turbolinks is a port of the Rails turbolinks gem for projects using the PHP Laravel 5.1+ framework.

Versions

Current versions of the following JavaScript libraries are used:

  • turbolinks: v5.0.0

For Laravel 5.0 supports see Frenzy Turbolinks 3.0.0 tag

For Laravel 4.1 or 4.2 supports see Frenzy Turbolinks 1.0 tag

Performance

Turbolinks makes following links in your web application faster. Instead of letting the browser recompile the JavaScript and CSS between each page change, it keeps the current page instance alive and replaces only the body and the title in the head.

Performance improvements will vary depending on the amount of CSS and Javascript you are using. You can get up to a 2X increase when using a lot of Javascript and CSS. You can find the Rails benchmarks here.

Installation

Using Composer

Run this command in a terminal:

composer require frenzy/turbolinks

Add the Turbolinks middleware, to the $middlewareGroups array in app/Http/Kernel.php:

        \Frenzy\Turbolinks\Middleware\StackTurbolinks::class,

NOTICE: For Laravel 5.4 and below, you must modify your config/app.php, in the providers array add :

    Frenzy\Turbolinks\TurbolinksServiceProvider::class

Add these scripts for automatic publication of assets, in your composer.json file:

{
   "scripts": {
       "post-install-cmd": [
           "php artisan vendor:publish --provider=\"Frenzy\\Turbolinks\\TurbolinksServiceProvider\" --force"
       ],
       "post-update-cmd": [
           "php artisan vendor:publish --provider=\"Frenzy\\Turbolinks\\TurbolinksServiceProvider\" --force"
       ]
   }
}

Add Javascript files into your project

Usage

Using turbolinks requires both the usage of the javascript library and the event listeners included with the component.

Javascripts

Both the original coffeescript version and compiled version of each script are available for use.

Using turbolinks.js

To enable turbolinks, all you need to do is add the compiled turbolinks javascript to your layout in the <head>section.

Installation with the Larasset package

Click here to publish the assets automatically.

Compatibility

The turbolinks javascript is designed to work with any browser that fully supports pushState and all the related APIs. This includes Safari 6.0+ (but not Safari 5.1.x!), IE10+, and latest Chrome and Firefox.

Do note that existing JavaScript libraries may not all be compatible with Turbolinks out of the box due to the change in instantiation cycle. You might very well have to modify them to work with Turbolinks' new set of events. For help with this, check out the Turbolinks Compatibility project.

Additional Resources

Please refer to the turbolinks project if you require additional information on the javascript libraries and their usage.

Bugs

For bugs or feature requests, please create an issue.

Credits

This package is based on the Symfony middleware package Helthe Turbolinks.