Skip to content

PhpSPA 👋

Ready to build modern, reactive web UIs without leaving the comfort of PHP? You're in the right place.

What is PhpSPA?

PhpSPA is a component-based library that brings the power and syntax of React to your PHP workflow. You build small, reusable components, and the library handles the magic of rendering them and updating the UI when their state changes.

License Version Documentation GitHub stars PHP Version Downloads PHP Tests


🚀 Quick Start

  • Installation


    Get started with PhpSPA in seconds using Composer

    Install Now

  • Core Concepts


    Learn the fundamentals of App and Component

    Learn Basics

  • Routing


    Master dynamic routing and navigation

    Explore Routing

  • State Management


    Build reactive UIs with useState and useEffect

    Manage State


✨ Key Features

Build your UI with small, reusable components just like React

<?php

function Button() {
   return <<<HTML
     <button>Click Me</button>
   HTML;
}

Components automatically re-render when state changes

<?php

$count = useState('count', 0);

return "<button onclick='setState(\"count\", {$count} + 1)'>
   Count: {$count}
</button>";

Navigate between pages without full page reloads

<Component.Link to="/about">About</Component.Link>

Call PHP functions directly from JavaScript without APIs

<?php

$greeter = useFunction(fn($name) => "Hello, $name!");

const greeting = await {$greeter('name')};

Documentation Overview

This documentation is designed to be fast and straight to the point. No long stories, just code. Let's dive in and start building something awesome. 🚀