https://github.com/torann/laravel-pjax-middleware
Enable the use of PJAX in Laravel.
https://github.com/torann/laravel-pjax-middleware
Last synced: 3 months ago
JSON representation
Enable the use of PJAX in Laravel.
- Host: GitHub
- URL: https://github.com/torann/laravel-pjax-middleware
- Owner: Torann
- License: bsd-2-clause
- Created: 2015-08-05T16:16:27.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2018-02-01T20:02:41.000Z (over 8 years ago)
- Last Synced: 2025-01-11T17:35:56.747Z (over 1 year ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel PJAX Middleware
Enable the use of PJAX in Laravel.
## Installation
Install using composer:
```
$ composer require torann/laravel-pjax-middleware
```
You'll then need to run `composer install` to download it and have the autoloader updated.
### Setup
Once installed you need to append the middleware class within the Http kernel. Open up `app/Http/Kernel.php` and find the `$middleware` variable.
```php
protected $middleware = [
Torann\Pjax\PjaxMiddleware::class,
]
```
#### 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.
Works great with [flight-with-pjax](https://github.com/Torann/flight-with-pjax) and [jquery.pjax.js](https://github.com/defunkt/jquery-pjax).