jacobbennett/pjax

PJAX for Laravel 5
44,274 115
Install
composer require jacobbennett/pjax
Latest Version:v3.0.0
PHP:>=5.4.0
License:MIT
Last Updated:Mar 10, 2020
Links: GitHub  ·  Packagist
Maintainer: JacobBennett

PJAX for Laravel 5.*

Latest Version on Packagist Total Downloads

Enable the use of PJAX in Laravel 5.*.

Installation

Add jacobbennett/pjax to require section in your composer.json

"jacobbennett/pjax": "~1.0"

Add 'JacobBennett\Pjax\PjaxMiddleware', to $middleware in app/Http/Kernel.php

How to use

This middleware will check, before outputting the http response, for the X-PJAX's header in the request. If found, it will crawl the response to return the requested element defined by X-PJAX-Container's header.

jQuery PJAX JS is required to use this package jquery.pjax.js.

See an example on Laracasts

Notes:

Sometimes when using PJAX it will timeout and trigger a standard page reload. This could be due to various factors but one thing you may try is to extend the default timeout for PJAX using this little snippet when you initialize PJAX.


$(document).ready(function(){

    // does current browser support PJAX
    if ($.support.pjax) {
    	$.pjax.defaults.timeout = 1000; // time in milliseconds
    }
    
});

Related Packages

frenzy/turbolinks

Frenzy Turbolinks makes following links in your web application faster with Lara...

23,362 160
rcrowe/turbo

Think turbolinks but for your PHP application. Powered by pjax.

3,409 87
simonstamm/laravel-pjax

PJAX for Laravel 4 with redirection-support

8,286 22
torann/laravel-pjax-middleware

Enable the use of PJAX in Laravel.

89 2
timgws/laravel-pjax

Laravel middleware for pjax. Use ajax and pushState to deliver a fast & seemless...

19 1