UI server components for Symfony, written in PHP.
Write the logic and the markup of a component in one .phpm file. The server renders the HTML and runs the events. You write no JavaScript and no API.
Get started$ composer require phem/phem
#[Component]
final class LikeButton
{
#[State]
public bool $liked = false;
public function toggle(): void
{
$this->liked = !$this->liked;
}
public function render(): Node
{
return (
<button onClick={{ toggle }}>
{{ liked ? '♥ Liked' : '♡ Like' }}
</button>
);
}
}