PHPackages                             polidog/use-php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. polidog/use-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

polidog/use-php
===============

React Hooks-like PHP components with server-side state management

v0.7.2(1mo ago)428911MITPHPPHP &gt;=8.5CI passing

Since Jan 26Pushed 1mo agoCompare

[ Source](https://github.com/polidog/usePHP)[ Packagist](https://packagist.org/packages/polidog/use-php)[ RSS](/packages/polidog-use-php/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (8)Versions (15)Used By (1)

usePHP
======

[](#usephp)

A framework that delivers server-driven UI with **minimal JavaScript**, using a React Hooks-like API.

Features
--------

[](#features)

- **React Hooks-like API** - Simple state management with `useState`
- **Function Components (Recommended)** - Lightweight components using simple PHP callables
- **Built-in Router** - Simple, swappable router with snapshot state preservation across pages
- **Minimal JS (~40 lines)** - Smooth UX with partial updates, graceful fallback without JS
- **Pure PHP by default** - No transpilation needed for `H::xxx()` style components
- **PSX (optional)** - TSX-like template syntax compiled by `usephp compile` for HTML-heavy UIs (see [PSX section](#psx-optional-tsx-like-syntax))
- **Configurable State Storage** - Choose between session (persistent) or memory (per-request) storage
- **Progressive Enhancement** - Works even with JavaScript disabled
- **Framework Integration** - Works with Laravel, Symfony, and other frameworks

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

[](#installation)

```
composer require polidog/use-php

# Copy JS file to public directory (full progressive enhancement layer)
./vendor/bin/usephp publish
```

Quick Start
-----------

[](#quick-start)

### 1. Create a Function Component

[](#1-create-a-function-component)

```
