A Laravel middleware that provides server-side support for jQuery Pjax to speed up page loads.
Spatie Laravel Pjax is a middleware package for Laravel that provides server-side support for the jQuery Pjax plugin. It speeds up page loading by returning only specific HTML fragments in response to Pjax requests, reducing bandwidth and improving perceived performance.
Laravel developers looking to implement Pjax-based navigation in their applications to enhance page load speeds without full page refreshes.
It offers a simple, middleware-based solution that integrates seamlessly with Laravel, supports cache busting via Laravel Mix, and is compatible with both jQuery Pjax and Vue-PJAX adapters.
A pjax middleware for Laravel
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Middleware detects X-PJAX headers and returns only the inner HTML content, skipping full layout rendering as per the Pjax plugin's server requirements, reducing bandwidth and server load.
Easy to set up by adding middleware to Laravel's kernel, fitting naturally into Laravel's request lifecycle without extensive configuration.
Integrates with Laravel Mix to automatically bust Pjax cache using versioned assets in the x-pjax-version meta tag, as shown in the README examples.
Compatible with Vue-PJAX adapter, allowing for Pjax implementations without jQuery dependency, though client-side setup is separate.
Relies on the jQuery Pjax plugin or Vue-PJAX adapter, which are niche and less maintained compared to modern SPA frameworks, limiting long-term viability.
Only works within Laravel applications, making it unsuitable for projects using other PHP frameworks or non-PHP stacks, as admitted in the package's focus.
Provides only server-side middleware; client-side implementation (e.g., jQuery Pjax or Vue-PJAX setup) requires additional configuration and dependencies, increasing complexity.