Search by

phil / instant-messenger-bundle

phil

phil/instant-messenger in Symfony: a form field that takes a messaging handle with its service among accepted enum sets, the constraint HandleOfType, and handles in Twig

Package info

github.com/parler-haut-interagir-librement/instant-messenger-bundle

Homepage

Type:symfony-bundle

pkg:composer/phil/instant-messenger-bundle

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0-alpha 2026-11-11 06:11 UTC

This package is auto-updated.

Last update: 2026-11-11 13:30:51 UTC


README

A messaging handle field with its service, a validation constraint and Twig filters for Symfony.

phil/instant-messenger-bundle brings phil/instant-messenger into a Symfony application. HandleType is two fields that give a Handle: the service, chosen among the accepted ones, and the handle as the person types it. The constraint HandleOfType checks a Handle by its service, and a text by detecting its service among the accepted ones. Twig gets messenger_display, messenger_link and messenger_label. Messages come in English and French.

It is for Symfony applications whose forms collect a way to reach someone: a member's Signal, a shop's WhatsApp, an organiser's Matrix ID. The field asks for the service because handles collide: a user name or a phone number fits several services. The accepted services are named as phil/url-bundle names kinds: null for every international service, an enum class, a case, an EnumSet or a list of these.

Use phil/instant-messenger directly outside Symfony or inside a domain model. The bundle has no column type: a handle is stored as two columns the application maps, the service with its own enum. It wires the library into Symfony Form, Validator and Twig, and adds no rule of its own.

Status

Part State
HandleType: the service chosen among the accepted ones, and the handle Implemented and tested
HandleOfType: a handle, or a text detected, on an accepted service Implemented and tested
Twig: messenger_display, messenger_link, messenger_label Implemented and tested
Messages in English and French Implemented and tested

Documentation

Document What it covers
Installation Requirements, installing, registering.
Forms and validation HandleType, HandleOfType, the accepted services, and storing a handle.
Twig The three filters.
Extension points What an application implements, configures, replaces or relies on.
Testing How the bundle is tested.
Reference Every type of the bundle.

Quick start

composer require phil/instant-messenger-bundle
$builder->add('messenger', HandleType::class, ['types' => [KnownMessenger::Signal, KnownMessenger::WhatsApp]]);
{% set link = shop.messenger|messenger_link %}
{% if link %}<a href="{{ link }}">{{ shop.messenger|messenger_label }} {{ shop.messenger|messenger_display }}</a>{% else %}{{ shop.messenger|messenger_label }} {{ shop.messenger|messenger_display }}{% endif %}

Requirements

PHP 8.5 or later; phil/instant-messenger 0.1 and phil/enums 0.3; symfony/config, symfony/dependency-injection, symfony/form, symfony/options-resolver and symfony/validator 8.2 or later. Twig is 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.