phil / reactions-bundle
Let members react to any content with emojis, the site's own included: an accessible picker, counters shown as you choose, no public count against a content.
Package info
github.com/parler-haut-interagir-librement/reactions-bundle
Type:symfony-bundle
pkg:composer/phil/reactions-bundle
Requires
- php: >=8.5
- ext-intl: *
- doctrine/dbal: ^4.5
- doctrine/orm: ^3.7
- phil/resource: ^0.1.1@dev
- psr/clock: ^1.0
- psr/event-dispatcher: ^1.0
- symfony/config: ^8.2
- symfony/dependency-injection: ^8.2
- symfony/http-foundation: ^8.2
- symfony/rate-limiter: ^8.2
- symfony/routing: ^8.2
- symfony/security-csrf: ^8.2
- symfony/service-contracts: ^3.6
- symfony/translation: ^8.2
- symfony/translation-contracts: ^3.6
- symfony/uid: ^8.2
- symfony/ux-live-component: ^3.7
- symfony/ux-twig-component: ^3.7
- twig/intl-extra: ^3.30
- twig/twig: ^3.21
Requires (Dev)
- ext-dom: *
- doctrine/doctrine-bundle: ^3.3
- phil/media-bundle: ^0.2@dev
- phil/privacy-bundle: ^0.1.1@dev
- phil/settings-bundle: ^0.1@dev || ^0.2@dev
- phil/ux-kit: >=0.5.0-alpha <1.0
- phil/ux-kit-shadcn: >=0.1.0-alpha <1.0
- php-webdriver/webdriver: ^1.16
- phpunit/phpunit: ^13.4
- symfony/asset-mapper: ^8.2
- symfony/browser-kit: ^8.2
- symfony/cache: ^8.2
- symfony/clock: ^8.2
- symfony/css-selector: ^8.2
- symfony/dom-crawler: ^8.1
- symfony/event-dispatcher: ^8.2
- symfony/filesystem: ^8.2
- symfony/framework-bundle: ^8.2
- symfony/http-kernel: ^8.2
- symfony/messenger: ^8.2
- symfony/panther: ^2.4
- symfony/security-core: ^8.2
- symfony/stimulus-bundle: ^3.7
- symfony/twig-bundle: ^8.2
- twig/extra-bundle: ^3.24
Suggests
- phil/media-bundle: For images of the site's emojis kept as media
- phil/privacy-bundle: For a member's reactions in the export and the erasure of their data
- phil/settings-bundle: For the visibility chosen among the settings of the site
- phil/ux-kit: For the recipes ReactionButton and ReactionPicker, through the Symfony UX Toolkit
- phil/ux-kit-shadcn: For the Tailwind versions of the same recipes, through the Symfony UX Toolkit
- symfony/asset-mapper: For the Stimulus controllers and the stylesheet without a build step
- symfony/messenger: For the events also sent on the message bus
- symfony/security-core: For the voter attribute and the member of the security token
- symfony/stimulus-bundle: For the Stimulus controllers
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-21 03:03:47 UTC
README
Reactions to any content for Symfony applications, as a Live Component that also works as a plain form.
phil/reactions-bundle lets the members of a site react to an article, a page, a post or anything else the application can name. Each member has one reaction per content by default, and can change it or take it back; a site that wants more lets each member give several, each emoji once, up to a cap it chooses. The site says which reactions it offers, in labelled sources — Unicode emojis and its own emojis, each an image with a replacement text — and who sees the reactions, their counters and the names of those who reacted. A reaction can be private, such as a "not useful": it never has a public counter or names, so a site offers no reaction counted against a content in public.
It is for any Symfony application with content to respond to: a blog, documentation, a forum, a wiki, announcements.
The application names its contents as references of phil/resource (article:42), its members by a stable
identifier — never an email address — and writes one voter; the bundle
keeps the reactions, draws them with the recipes of the kit it requires, and refuses every reaction until a voter says
otherwise.
A page of many contents reads them in one query for each thing to know. Every button is the button of a plain form the component takes over, so reacting works without JavaScript; the picker adds a search and the keyboard by Stimulus. The services hold nothing between two requests of a worker.
Status
| Part | State |
|---|---|
Reaction, one per member and per content or several up to a cap, its moment in UTC; Doctrine store, and in-memory store emptied between two requests |
Implemented and tested, on SQLite |
A member named by a stable identifier of the site, @ refused |
Implemented and tested |
| The list in sources, private reactions, the visibility | Implemented and tested |
Reactions, the voter attribute, the rate limit, the events |
Implemented and tested |
ReactionBoard, the counters of a page read at once, the names as a list in the language of the page |
Implemented and tested, with a benchmark and a page measured in worker mode |
The Live Component PhilReactions and the plain form with its CSRF token and signed address |
Implemented and tested, with each kit |
| The Stimulus controllers, fetched lazily, and their paths for AssetMapper | Implemented and tested under Node, with AssetMapperBundle and StimulusBundle, and in a headless Chrome; the checks a person makes with a screen reader listed in testing |
| The erasure and the export of a member's reactions, images as media read in one query, visibility among the settings | Implemented and tested, when their package is there |
| Notifications, moderation, reputation | Not part of the bundle: they listen to the events or read the store |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, the bundle, the table, the routes, the recipes, the stylesheet. |
| Configuration | Every option, the services registered. |
| Reactions | The list, several reactions per member, private reactions, the visibility, the member, the voter, the rate limit. |
| The component | The Live Component, the plain form, a page of many contents, the accessibility, the picker. |
| Events | The events, the message bus, the erasure. |
| Extension points | What an application implements, configures or replaces. |
| Testing | The tests, the benchmark, the checks in a browser. |
| Reference | Every class and file of the bundle. |
Quick start
composer require phil/reactions-bundle php bin/console ux:install reaction-button --kit=github.com/parler-haut-interagir-librement/ux-kit php bin/console ux:install reaction-picker --kit=github.com/parler-haut-interagir-librement/ux-kit
# config/routes/phil_reactions.yaml phil_reactions: resource: '@PhilReactionsBundle/config/routes.php' prefix: /_reactions
# config/packages/phil_reactions.yaml phil_reactions: current_member: App\Reactions\AccountMember # gives the stable identifier of the signed-in member
final class ReactionVoter extends Voter { protected function supports(string $attribute, mixed $subject): bool { return Reactions::REACT === $attribute && $subject instanceof ReactionSubject; } protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token, ?Vote $vote = null): bool { return $token->getUser() instanceof UserInterface; } }
{{ reactions_preload(articles|map(article => 'article:' ~ article.id)) }}
{% for article in articles %}
<twig:PhilReactions content="article:{{ article.id }}" />
{% endfor %}
Requirements
PHP 8.5 or later with ext-intl, Symfony 8.2 or later, Symfony UX Live Component 3.7 or later, twig/intl-extra,
Doctrine DBAL 4.5 and ORM 3.7. Symfony Security, Messenger, AssetMapper, phil/media-bundle, phil/settings-bundle
and phil/privacy-bundle are optional.
Contributing
Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.
License
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.