dconco/phpspa
dconco/phpspa has 71 GitHub stars and 9 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-17 21:07 UTC. Last push 2026-11-13.
What you can do
- 🧩 Components Reusable & Modular Build once, use everywhere - 🧠 State Reactive Updates Auto-sync state changes - ⚡ Performance Zero Full Reloads SPA-like experience - 🎯 Simple Minimal Setup Works out of the box
Measured star growth
- in 24h
- 0
- in 7 days
- Update delayed
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
About
A component-based library for building modern, reactive user interfaces in pure PHP. Inspired by React. ✨
Web & AppsREADME.md
OriginalComponent-Based PHP Library for Modern Web Applications
Build dynamic, interactive web applications using reusable PHP components with state management and SPA-like behavior — no JavaScript frameworks required.
✨ Key Features
|
🧩 Components
Reusable & Modular Build once, use everywhere |
🧠 State
Reactive Updates Auto-sync state changes |
⚡ Performance
Zero Full Reloads SPA-like experience |
🎯 Simple
Minimal Setup Works out of the box |
🚀 Getting Started
🎯 Ready to Jump In? Start with our Template!
Get up and running in 30 seconds with a complete PhpSPA example
|
📦 Clone Template Pre-configured project structure |
⚡ Instant Setup Dependencies + server ready |
Step 1: Clone the Template
composer create-project phpspa/phpspa my-phpspa-app
cd my-phpspa-app
Step 3: Start Development Server
composer start
🎉 That's it! Your PhpSPA application is now running locally.
Open your browser and start building amazing components!
🚀 Quick Start
If you want to set up PhpSPA manually, maybe in an existing project, follow these steps:
Install
composer require dconco/phpspa
Namespace
First you need to include the namespace at the beginning of your app.
<?php
use PhpSPA\App;
use PhpSPA\Component;
use function Component\useState;
require_once 'vendor/autoload.php';
Create Component
function HomePage() {
$counter = useState("count", 0);
return <<<HTML
<h1>Counter: {$counter}</h1>
<button onclick="setState('count', {$counter} + 1)">+</button>
<Component.Link to="/about" children="About" />
HTML;
}
Setup App
$app = new App(fn() => '<div id="app"></div>');
$app->attach((new Component('HomePage'))->route('/'));
$app->run();
⚡ Native Compression (C++ FFI)
To enable the fastest HTML/CSS/JS compression, add this to your php.ini:
ffi.enable=true
extension=ffi
Then add this line to your code:
use PhpSPA\Compression\Compressor;
$app->compression(Compressor::LEVEL_AGGRESSIVE, true)
You’ll see X-PhpSPA-Compression-Engine: native in response headers when active.
🎨 What You Get
|
🧱 Component Architecture
Clean, reusable PHP components |
🔄 Reactive State
Auto-updating UI with simple state management |
|
🌍 SPA Navigation
Smooth page transitions without reloads |
🪶 Lightweight
PhpSPA is dependency-free, which makes it extra fast |
|
🛡️ SEO Ready
Server-rendered for search engines |
⚙️ Framework Agnostic
Works with any PHP setup |
📚 Learn More
🔗 Complete Documentation — Full tutorials, examples and guides
👉 API References — Detailed API documentation for all PhpSPA features
📦 Packagist — Installation and versions
🤝 Contributing
We welcome contributions from the community! Whether you want to add new hooks, fix bugs, or improve documentation, your help is appreciated.
👉 Read our Contributing Guide to get started