Lue dans les fichiers PHP du paquet au commit ca8a648306a4 : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.
AccessExtensionclassWhat a page asks of the visitor's host: whether the visitor may do something, `is_granted(attribute, subject)` (omnisense/omnibridge's Access), and the token a form of theirs carries against cross-site requests, `csrf_token(intent)` (Tokens) - under the names Symfony gives them, answered by the host's adapters.
2 methods
ContractExtensionclassWhat a page may use beyond Twig itself: `path()`, `url()`, `asset()` and the `trans` filter, under the names Symfony gives them. A framework that already has them (Symfony) does not register this extension; any other one does, with its own answers to the contract.
3 methods
HelperExtensionclassThe small helpers omnibase gives the templates of its sites, for a framework rendering those templates without omnibase: the same names and the same results as omnibase's (Resources/Functions.php and FunctionTwigExtension), framework-free. Copied here because two frameworks now need them (plan 0, rule 13); omnibase registers this extension first and its own win where they do more. |at and |emoji_only are only here (they left omnibase's FunctionTwigExtension, audit R24).
16 methods · 3 constants
MapExtensionclassomnisense/omnimap in a page, whichever framework renders it:
5 methods · 2 constants
Omnibridge\Twig
AccessExtension class
final class AccessExtension extends AbstractExtension AccessExtension.php:24
What a page asks of the visitor's host: whether the visitor may do
something, is_granted(attribute, subject) (omnisense/omnibridge's
Access), and the token a form of theirs carries against cross-site
requests, csrf_token(intent) (Tokens) - under the names Symfony gives
them, answered by the host's adapters.
Registered by every host, Symfony included (omnibridge/symfony, after twig-bridge's SecurityExtension and CsrfExtension, whose functions it then answers with the same services), so that a page asks the same code whichever framework renders it. A contract the host does not bind leaves its function out (a Symfony application without SecurityBundle or without CSRF protection).
AccessExtension::__construct()
public function __construct(readonly ?Access $access = null, readonly ?Tokens $tokens = null)AccessExtension::getFunctions()
public function getFunctions(): arrayContractExtension class
final class ContractExtension extends AbstractExtension ContractExtension.php:17
What a page may use beyond Twig itself: path(), url(), asset() and the trans
filter, under the names Symfony gives them. A framework that already has
them (Symfony) does not register this extension; any other one does, with
its own answers to the contract.
ContractExtension::__construct()
public function __construct(readonly Urls $urls, readonly Translations $translations)ContractExtension::getFunctions()
public function getFunctions(): arrayContractExtension::getFilters()
public function getFilters(): arrayHelperExtension class
final class HelperExtension extends AbstractExtension HelperExtension.php:18
The small helpers omnibase gives the templates of its sites, for a framework rendering those templates without omnibase: the same names and the same results as omnibase's (Resources/Functions.php and FunctionTwigExtension), framework-free. Copied here because two frameworks now need them (plan 0, rule 13); omnibase registers this extension first and its own win where they do more. |at and |emoji_only are only here (they left omnibase's FunctionTwigExtension, audit R24).
const SHORTEN_FRONT = -1const SHORTEN_MIDDLE = 0const SHORTEN_BACK = 1
HelperExtension::__construct()
public function __construct(readonly string $locale = 'fr', readonly ?string $timezone = null)HelperExtension::getFunctions()
public function getFunctions(): arrayHelperExtension::getFilters()
public function getFilters(): arrayHelperExtension::htmlAttributes()
public static function htmlAttributes(array ...$attributes): stringclass="a b" data-x="y", the values as given (omnibase's html_attributes()).
HelperExtension::shorten()
public static function shorten(?string $haystack, int $length = 100, int $position = self::SHORTEN_BACK, string $separator = ' [..] '): ?stringA text cut to $length characters, the separator where it was cut (omnibase's str_shorten()).
HelperExtension::ucfirst()
public static function ucfirst(array|string|null $text): array|stringHelperExtension::second()
public static function second(iterable|null $list): mixedHelperExtension::joinIfExists()
public static function joinIfExists(?array $list, string $separator): ?stringHelperExtension::highlight()
public static function highlight(?string $content, string|array|null $pattern): ?stringThe words of $pattern marked in $content (omnibase's highlight, without its excerpt mode).
HelperExtension::lessThan()
public static function lessThan(mixed $date, mixed $diff): boolWhether $date is more recent than $diff ("+2 day": less than two days ago).
HelperExtension::at()
public static function at(array $array, int|string $index): mixedA list's entry at an index, null when it has none (omnibase's |at).
HelperExtension::isEmojiOnly()
public static function isEmojiOnly(?string $value): boolWhether a text is made of emoji alone, spaces aside (omnibase's |emoji_only: a comment of one emoji shown big).
HelperExtension::lang()
public static function lang(?string $locale): stringfr-FR, fr_FR: fr.
HelperExtension::country()
public static function country(?string $locale): stringen-GB: GB; a bare language, its own country (fr: FR).
HelperExtension::datetime()
public function datetime(mixed $date, string $pattern = 'YYYY-MM-dd HH:mm:ss', ?string $locale = null): stringA date in the page's language by an ICU pattern, lower case, as omnibase gives it ("MMMM YYYY": "mars 2022", |title after it for "Mars 2022").
A string in ISO 8601 (a screen's moment, omnibase's Base\Screen\Shape::moment(): 2026-04-10T18:05:00+00:00) is that moment, printed as the DateTime it came from was in the extension's time zone - as omnibase's |datetime reads it since 25b8ebac; any other string is not read as a date, only lowered ("Présent", "Now"); none is the pattern itself.
HelperExtension::isMoment()
public static function isMoment(string $value): boolWhether a string is a moment in ISO 8601: a date, a time, and a zone or not (omnibase's FunctionTwigExtension::isMoment()).
MapExtension class
final class MapExtension extends AbstractExtension MapExtension.php:30
omnisense/omnimap in a page, whichever framework renders it:
{{ omnimap(view) }} the picture kept, or the live map (MapPrinter's rule) {{ omnimap_export(view, {class: 'item', text: '…'}) }} the button that sends the live map's picture to the cache {{ omnimap_suppress(view, {text: '…'}) }} the button that deletes it
Who may change the map is the host's Access ($control, ROLE_ADMIN by default); the buttons post to the routes named $routes with a token of the host's Tokens (intents "omnimap-export", "omnimap-suppress"): under Symfony omnibridge/symfony's map cache routes; under Laravel routes the application declares itself (omnibridge/laravel routes the tile only). Registered by omnibridge/symfony and omnibridge/laravel when omnimap is configured.
const EXPORT = 'omnimap-export'const SUPPRESS = 'omnimap-suppress'
MapExtension::__construct()
public function __construct(readonly MapPrinter $printer, readonly Urls $urls, readonly ?Access $access = null, readonly ?Tokens $tokens = null, readonly string $control = 'ROLE_ADMIN', readonly array $routes = [])MapExtension::getFunctions()
public function getFunctions(): arrayMapExtension::map()
public function map(?MapView $view): stringMapExtension::export()
public function export(?MapView $view, array $attributes = []): string$attributesthe button's, and its text
MapExtension::suppress()
public function suppress(?MapView $view, array $attributes = []): string$attributesthe button's, and its text