tbitowner / pjax by tbitowner

Service Provider to set headers for a pjax request
Package Data
Maintainer Username: tbitowner
Maintainer Contact: adam@healthendeavors.com (adam)
Package Create Date: 2015-11-06
Package Last Update: 2015-11-09
Language: PHP
License: Unknown
Last Refreshed: 2024-02-26 15:11:51
Package Statistics
Total Downloads: 14
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

PJAX for Laravel 4

Enable the use of PJAX in Laravel 4.

If using Laravel 5, please see jacobbennett/pjax


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

composer require endeavors/pjax

Add 'Endeavors\Pjax\PjaxServiceProvider', to your providers array in your app/config/app.php

How to use

This service provider will check, before output 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.

Works great with jquery.pjax.js.


I'm open to any idea of features to add to it.

This is almost identical to https://github.com/vtalbot/pjax

I removed the code portion below as I had trouble getting it working. Probably because I didn't have a 'head title'.

$title = $crawler->filter('head title')->html();
$response->setContent('<title>' . $title . '</title>' . $html);