PHPackages                             jarir-ahmed/universal-spa - 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. [Framework](/categories/framework)
4. /
5. jarir-ahmed/universal-spa

ActiveLibrary[Framework](/categories/framework)

jarir-ahmed/universal-spa
=========================

A framework-agnostic Single Page Application (SPA) engine for PHP

00JavaScript

Since May 24Pushed 2w agoCompare

[ Source](https://github.com/jarir2020/universal-spa)[ Packagist](https://packagist.org/packages/jarir-ahmed/universal-spa)[ RSS](/packages/jarir-ahmed-universal-spa/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Universal SPA Engine (jarir-ahmed/universal-spa)
================================================

[](#universal-spa-engine-jarir-ahmeduniversal-spa)

A lightning-fast, zero-reload Single Page Application (SPA) engine for **any** PHP Framework (Laravel, CodeIgniter, Symfony, Slim, or even raw PHP).

Two Modes
---------

[](#two-modes)

This package empowers you with two distinct approaches:

### 1. HTML Mode (Zero Backend Required)

[](#1-html-mode-zero-backend-required)

In this mode, the frontend JavaScript fetches the full HTML page, parses it in the browser using `DOMParser`, and swaps out the body. **Pros:** Requires ZERO PHP changes. Works with static sites or any backend.

### 2. JSON Mode (Bandwidth Optimized)

[](#2-json-mode-bandwidth-optimized)

In this mode, the PHP backend intercepts the response buffer, parses the HTML, and sends only the required parts (Title, Body, Scripts) as a tiny JSON object. **Pros:** Faster network transfer.

Installation
------------

[](#installation)

```
composer require jarir-ahmed/universal-spa
```

Setup (JSON Mode)
-----------------

[](#setup-json-mode)

1. Put this at the very top of your PHP application (e.g., `public/index.php` or as a middleware):

```
\JarirAhmed\UniversalSpa\SpaEngine::start();
```

2. Add `data-spa-content` to your main wrapper in your HTML layout:

```

```

3. Add the `data-spa` attribute to any links you want to feel instant:

```
About Us
```

4. Include the JS script and initialize it:

```

    new JarirSpa({
        mode: 'json' // or 'html'
    });

```

License
-------

[](#license)

MIT

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance63

Regular maintenance activity

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

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/20700f34ff813055154e843bbdbe04d33320c1e6a81bbb3301cad67cb8350fd3?d=identicon)[jarircse16](/maintainers/jarircse16)

### Embed Badge

![Health badge](/badges/jarir-ahmed-universal-spa/health.svg)

```
[![Health](https://phpackages.com/badges/jarir-ahmed-universal-spa/health.svg)](https://phpackages.com/packages/jarir-ahmed-universal-spa)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k104.3M822](/packages/laravel-socialite)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k38.6M289](/packages/laravel-dusk)[pinguo/php-msf

Pinguo Micro Service Framework For PHP

1.7k4.2k](/packages/pinguo-php-msf)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)

PHPackages © 2026

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