PHPackages                             timgws/laravel-pjax - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. timgws/laravel-pjax

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

timgws/laravel-pjax
===================

Laravel middleware for pjax. Use ajax and pushState to deliver a fast &amp; seemless browsing experience

119PHP

Since Jun 7Pushed 9y ago1 watchersCompare

[ Source](https://github.com/timgws/laravel-pjax)[ Packagist](https://packagist.org/packages/timgws/laravel-pjax)[ RSS](/packages/timgws-laravel-pjax/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

laravel-pjax
============

[](#laravel-pjax)

**laravel-pjax** is a pjax middleware for Laravel &gt;5.1.

By adding [pjax](https://github.com/defunkt/jquery-pjax) &amp; jQuery to your web application, ajax and pushState can be used to deliver a fast browsing experience with real permalinks, page titles, and a working back button.

This middleware adds some functionality that other middleware (at the time of writing) did not provide, such as container whitelists and faster page filtering.

I wanted to have some additional functionality for loading "pjax" AJAX requests, so I quickly threw together this package.

Setting up the middleware
-------------------------

[](#setting-up-the-middleware)

Install the package:

```
# composer require timgws/laravel-pjax
```

Add the middleware to your app's kernel configuration. The higher the better!

```
// app/Http/Kernel.php

// ...
protected $middleware = [
    // ...
    \timgws\pjax\Middleware::class,
];
```

Add the service provider:

```
// config/app.php

// ...
    'providers' => [
        // ... Laravel providers

        timgws\pjax\ServiceProvider::class,

        // ... app providers ...
    ],
```

Publish the config file:

```
php artisan vendor:publish --provider="timgws\pjax\ServiceProvider" --tag="config"
```

and test!

Limiting containers that can be requested
-----------------------------------------

[](#limiting-containers-that-can-be-requested)

One major difference between this module and other Laravel pjax middleware is that you can limit which containers can be requested via HTTP headers.

You may wish to edit the `pjax.php` config file to limit `valid_containers`

```
return [
    'valid_containers' => [
        '#pjax-container', '.content'
    ]
];
```

See  for further information.

Force reload of page when version changes
-----------------------------------------

[](#force-reload-of-page-when-version-changes)

Inside config.php, set the layout version to force a hard reload of the requested page when a client is on an old version of the layout.

Bumping the version will force clients to do a full reload the next request getting the new layout and assets

Set the version to something like 'v1'. Also, you will need to add a meta tag like this to the base layout:

```

```

```
      return [
          'layout_version' => 'v1'
      ];
```

See  for further information.

Contributors
------------

[](#contributors)

### Contributors on GitHub

[](#contributors-on-github)

- [Tim Groeneveld](http://timg.ws)

License
-------

[](#license)

- MIT License (see [LICENSE](https://github.com/timgws/laravel-pjax/blob/master/LICENSE.md) file)

TODO
----

[](#todo)

- Build test suite

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e950378ef4ed66fb3df70c8b59a7bf9ba5df39c8b6be3f85a4ae484af4992d77?d=identicon)[timgws](/maintainers/timgws)

---

Top Contributors

[![timgws](https://avatars.githubusercontent.com/u/1050232?v=4)](https://github.com/timgws "timgws (22 commits)")

---

Tags

ajaxjquery-pjaxlaravel-pjaxpjax-middleware

### Embed Badge

![Health badge](/badges/timgws-laravel-pjax/health.svg)

```
[![Health](https://phpackages.com/badges/timgws-laravel-pjax/health.svg)](https://phpackages.com/packages/timgws-laravel-pjax)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
