
Build dynamic, interactive web applications using reusable PHP components with state management and SPA-like behavior — no JavaScript frameworks required.
🧩 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 |
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
git clone https://github.com/mrepol742/phpspa-example my-phpspa-app
cd my-phpspa-app
Step 2: Install Dependencies
composer install
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!
composer require dconco/phpspa
function HomePage() {
$counter = createState("count", 0);
return <<<HTML
<h1>Counter: {$counter}</h1>
<button onclick="phpspa.setState('count', {$counter} + 1)">+</button>
<Component.Link to="/about" children="About" />
HTML;
}
$app = new App('layout');
$app->targetId('app');
$app->attach((new Component('HomePage'))->route('/'));
$app->run();
- Run locally:
composer install
composer test
- CI: Tests run on push/PR to
main
anddev
via GitHub Actions (see badge above). The entrypoint istests/Test.php
which runs the semicolon/ASI suite and a simple compression check.
🧱 Component Architecture Clean, reusable PHP components |
🔄 Reactive State Auto-updating UI with simple state management |
🌍 SPA Navigation Smooth page transitions without reloads |
🪶 Lightweight Just one small JavaScript file |
🛡️ SEO Ready Server-rendered for search engines |
⚙️ Framework Agnostic Works with any PHP setup |
🔗 Complete Documentation — Full tutorials, examples, and API reference
👉 GitHub Repository — Source code and issues
📦 Packagist — Installation and versions