- Can I install strontium/pjax-bundle in a Laravel application?
- No. strontium/pjax-bundle is a Symfony 2 bundle, not a Laravel package. It wires up Symfony EventDispatcher listeners on kernel.controller and kernel.response and registers services through the Symfony DI container and AppKernel, none of which exist in Laravel's HTTP kernel or container. There is no drop-in integration path, and Composer will pull in Symfony 2.x-era http-kernel constraints that conflict with the Symfony 6/7 components used by Laravel 9, 10 and 11.
- Does strontium/pjax-bundle support Laravel 9, 10 or 11?
- It does not support any Laravel version. The package targets Symfony 2, which reached end of life in November 2018, and it expects Symfony bundle discovery rather than Laravel package auto-discovery. Attempting a Composer install against a modern Laravel app will typically fail dependency resolution before you even reach runtime. If you want PJAX-style navigation on Laravel, use a Laravel-native package instead.
- What does strontium/pjax-bundle actually do?
- It integrates defunkt/jquery-pjax into Symfony 2 applications. The bundle registers kernel listeners that detect a PJAX request header and return a page fragment instead of the full layout, and it ships Twig helpers plus configurable selectors for the container to swap. On the client side, jQuery PJAX updates the visible container, pushes browser history state and adjusts the URL so back and forward buttons still work. The net effect is faster in-app navigation without building a full single-page app.
- What is the Laravel equivalent of jQuery PJAX?
- The closest conceptual match is hotwired/turbo-laravel, which handles page swaps, history and scroll restoration out of the box. htmx gives you the most granular control when only specific regions of a page should swap, and Livewire Navigate is the right pick if Livewire is already in your stack. Inertia is a heavier option for teams essentially building an SPA. All four are Laravel-native, jQuery-free and actively released.
- How do I build PJAX-style navigation in Laravel myself?
- You need three pieces and roughly one to two developer days. First, write a middleware that branches on an X-PJAX request header and swaps the render target, returning a partial view instead of the full layout. Second, create a single Blade layout with a stable container element and a matching yield or component boundary, keeping one controller action that can return both shapes so you do not maintain parallel routes. Third, drop in Turbo or htmx on the client to perform the swap and manage history.
- Why is strontium/pjax-bundle a security and maintenance risk in production?
- Symfony 2 has been end of life since November 2018, and defunkt/jquery-pjax was archived by its author and receives no fixes. The transitively implied jQuery 1.x/2.x line carries open CVEs, and the package itself shows only 3 stars, zero dependents, a single maintainer and no CI or release cadence. Zero dependents means there is no production ecosystem validating the integration semantics. Adopting it means accepting permanent compatibility and security debt from day one.
- Will PJAX break SEO, deep links or users without JavaScript?
- It should not, provided you implement progressive enhancement correctly. Every navigable URL must return a complete server-rendered page when the fragment header is absent, so crawlers and no-JS users get a normal full load while enhanced clients get the fragment. The middleware should only short-circuit to a partial view when it sees the explicit header, never based on user agent or other guesses. PJAX degrading to a full page load is usually acceptable, but state that requirement explicitly before you start.
- What breaks when PJAX swaps page fragments?
- Anything that assumes a full document lifecycle is a candidate: inline per-page scripts, DOM-ready handlers, analytics pageview events and global JS state all silently stop firing or go stale. Third-party widgets, ad slots and embeds that self-initialize on load typically need an explicit re-init hook. Turbo and htmx both expose lifecycle events you can bind re-initialization to, so audit every page-level script before migrating.
- Should I use Turbo or htmx for PJAX in Laravel?
- Choose Turbo if your goal is broad full-page navigation feeling instant, since it most closely mirrors what PJAX does and adds scroll restoration. Choose htmx if you want surgical control over which regions swap and prefer to keep normal full-page navigation elsewhere. If Livewire is already installed, Livewire Navigate is the lowest-friction option. All three avoid the jQuery runtime and track current Laravel releases, which removes the Symfony version constraint problem entirely.
- Can I use this bundle as a reference implementation without installing it?
- Yes, and that is the recommended use. Read the bundle to understand the contract: a request header that signals a fragment request, a server-side branch that swaps the render target, a layout with a stable container, and a client library that performs the swap and pushes history. Reimplement that contract with Laravel middleware and Blade partials rather than migrating the code. Before you commit, confirm your PHP floor and Laravel major, and decide whether you are willing to own a small piece of custom middleware indefinitely.