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.0.3(3mo ago)322MITPHPPHP &gt;=8.5CI passing

Since Jan 26Pushed 3mo agoCompare

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

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

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** - No transpilation needed, PHP code runs directly on the server
- **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 (required for partial updates)
./vendor/bin/usephp publish
```

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

[](#quick-start)

### 1. Create a Function Component

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

```
