Aller au contenu

omnibase/consent Référence de l’API

Étage
Structure préparée · Omnibase
Version
main
Vérifié en réel
Son README ne le dit pas
Licence
MIT
composer require omnibase/consent:dev-main

Lue dans les fichiers PHP du paquet au commit d94cf01a71de : 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é.

Base\Consent

  • ConsentBundle class

    The name the sites register (config/bundles.php) and omnibase's bundle scan reads (a class Base\<Name>\<Name>Bundle, its folder src/): the bundle itself is Base\Consent\Bridge\Symfony\ConsentBundle, since step C8 of the plan "omnibase agnostique".

    1 method

  • ConsentConfig class

    A site's `consent:` configuration made whole without Symfony's Config component: what Bridge\Symfony\DependencyInjection\ConsentConfiguration gives the panel under Symfony - every key with its default, a feature written `NAME: ~` or `NAME: false` made an entry, each storage entry written as a name made whole - for a framework that has none of it (Laravel: omnibridge/laravel builds the panel from the Symfony site's config/packages/consent.yaml). The defaults are this class's, and the configuration tree takes them from here (audit "lesringostars face au master plan", R24: formerly the Laravel twin's own copy).

    1 method · 4 constants

  • ConsentPanel class

    The cookie answer itself, without the framework (plan "omnibase agnostique", step C8): the features the visitor answers for and what each keeps, the countdown, the privacy page's address, in the visitor's words.

    5 methods · 1 constant

Base\Consent\Bridge\Symfony

  • ConsentBundle class

    The cookie answer shared by the omnibase sites, under Symfony: a Twig partial (@Consent/_cookie.html.twig), its script and its stylesheet (bundles/consent/), and the `consent:` configuration. The answer itself (Base\Consent\ConsentPanel) and its Twig functions (Bridge\Twig) load without the framework (tests/Fondation.php, plan "omnibase agnostique", step C8).

    2 methods

Base\Consent\Bridge\Symfony\DependencyInjection

  • ConsentConfiguration class

    The site's `consent:` configuration under Symfony; its defaults are Base\Consent\ConsentConfig's, which makes the same configuration whole without Symfony (a framework other than Symfony reads the site's file).

    1 method

  • ConsentExtension class

    2 methods

Base\Consent\Bridge\Symfony\Twig

  • ConsentExtension class

    The partial's functions under Symfony (the service the bundle registers, known to the sites as Base\Consent\Twig\ConsentExtension): the panel built from the container - the site's `consent:` configuration and the bundle's features, the translator, omnibase's router for the privacy page, the main request's session for its cookie's name.

    1 method

Base\Consent\Bridge\Twig

  • ConsentExtension class

    The partial's two functions over a ConsentPanel, in any Twig environment: consent_options(), what the partial prints (the features and their switches, the countdown, the privacy page's URL), and consent_settings(), the same as the configuration @glitchr/flowjs/cookie reads (JSON, safe in a <script type="application/json">). Twig and the panel, nothing else: a framework other than Symfony builds the panel and adds this extension.

    6 methods · 1 constant

class ConsentBundle extends ConsentBundle ConsentBundle.php:13

The name the sites register (config/bundles.php) and omnibase's bundle scan reads (a class Base\<Name>\<Name>Bundle, its folder src/): the bundle itself is Base\Consent\Bridge\Symfony\ConsentBundle, since step C8 of the plan "omnibase agnostique".

public function __construct()

final class ConsentConfig ConsentConfig.php:20

A site's consent: configuration made whole without Symfony's Config component: what Bridge\Symfony\DependencyInjection\ConsentConfiguration gives the panel under Symfony - every key with its default, a feature written NAME: ~ or NAME: false made an entry, each storage entry written as a name made whole - for a framework that has none of it (Laravel: omnibridge/laravel builds the panel from the Symfony site's config/packages/consent.yaml). The defaults are this class's, and the configuration tree takes them from here (audit "lesringostars face au master plan", R24: formerly the Laravel twin's own copy).

One configuration, as written (the consent key of the YAML); the validation of the tree (an unknown key, a countdown below 0...) is the Symfony site's.

The configuration's keys, in the tree's order, with their defaults.

The privacy signals of the browser, none honoured by default.

A feature's keys, in the tree's order, with their defaults (enabled aside).

A storage entry's keys, in the tree's order, with their defaults (name aside).

public static function normalize(array $site): array
$site

the site's consent: configuration

Returns

what the tree gives: the keys written first, in their order, then those left unsaid with their defaults, in the tree's order

class ConsentPanel ConsentPanel.php:26

The cookie answer itself, without the framework (plan "omnibase agnostique", step C8): the features the visitor answers for and what each keeps, the countdown, the privacy page's address, in the visitor's words.

options(): what the partial prints - the features and their switches, the countdown, the privacy page's URL. settings(): the same, as the configuration @glitchr/flowjs/cookie reads (JSON, json()): the features are its categories, with what each stores.

Plain PHP: the site's configuration, a translator (symfony/translation's contract; the catalogue's names when it is also a TranslatorBagInterface), and two closures for what the framework knows - a route's address, the session's name. The Twig functions are Bridge\Twig\ConsentExtension's; under Symfony, Bridge\Symfony\Twig\ConsentExtension builds this from the container (Base\Consent\Twig\ConsentExtension, the name the sites know).

What is not the page's: a click there neither answers the question (dismiss) nor closes the panel - Symfony's web debug toolbar (.sf-toolbar, open or folded, around sfwdt<token> and its sfToolbar* parts), a dump() printed in the page, and what a site marks with data-consent-ignore (or the library's data-cookie-ignore).

public function __construct(readonly array $config, readonly TranslatorInterface $translator, readonly array $defaults = [], readonly ?\Closure $urls = null, readonly ?\Closure $session = null)
$config

the site's consent: configuration (as ConsentConfiguration processes it)

$translator

the consent domain's words in the visitor's language

$defaults

the bundle's own features (self::features(), config/features.php)

$urls

a route's address: the privacy page's (consent.privacy_route); none, no link

$session

the session cookie's name; none (or null), PHP's own

public static function features(): array

The features every site starts from (consent.defaults: true), in the shape of consent.features: config/features.php, the bundle's own list.

public function options(): array

The site's own groups and the features it declares itself, as the partial has always handed them (data-consent-features): what a page whose scripts are from before @glitchr/flowjs/cookie still reads.

public function settings(): array

The configuration of @glitchr/flowjs/cookie: every feature a category (the bundle's own under the site's), its words in the visitor's language, what it stores; the countdown, the answer's lifetime, the privacy signals; and, under "consent", what the bundle's own script reads (the site's own feature, the features split from another, the durations in words).

public function json(): string

settings(), for a <script type="application/json">: no "<" left to end the script with.

class ConsentBundle extends AbstractBaseBundle ConsentBundle.php:19

The cookie answer shared by the omnibase sites, under Symfony: a Twig partial (@Consent/_cookie.html.twig), its script and its stylesheet (bundles/consent/), and the consent: configuration. The answer itself (Base\Consent\ConsentPanel) and its Twig functions (Bridge\Twig) load without the framework (tests/Fondation.php, plan "omnibase agnostique", step C8).

Sites register it as Base\Consent\ConsentBundle, the subclass that keeps that name.

public function __construct()
public function getPath(): string

Modern layout: the bundle root is the package root (templates/, public/, translations/).

class ConsentConfiguration extends AbstractBaseConfiguration ConsentConfiguration.php:14

The site's consent: configuration under Symfony; its defaults are Base\Consent\ConsentConfig's, which makes the same configuration whole without Symfony (a framework other than Symfony reads the site's file).

public function getConfigTreeBuilder(): TreeBuilder

class ConsentExtension extends AbstractBaseExtension ConsentExtension.php:12

public function getConfiguration(array $config, ContainerBuilder $container): ConsentConfiguration
public function load(array $configs, ContainerBuilder $container): void

class ConsentExtension extends TwigConsentExtension ConsentExtension.php:19

The partial's functions under Symfony (the service the bundle registers, known to the sites as Base\Consent\Twig\ConsentExtension): the panel built from the container - the site's consent: configuration and the bundle's features, the translator, omnibase's router for the privacy page, the main request's session for its cookie's name.

public function __construct(array $config, UrlGeneratorInterface $urls, TranslatorInterface $translator, array $defaults = [], ?RequestStack $requests = null)
$config

the site's consent: configuration

$defaults

the bundle's own features (config/features.php)

class ConsentExtension extends AbstractExtension ConsentExtension.php:17

The partial's two functions over a ConsentPanel, in any Twig environment: consent_options(), what the partial prints (the features and their switches, the countdown, the privacy page's URL), and consent_settings(), the same as the configuration @glitchr/flowjs/cookie reads (JSON, safe in a <script type="application/json">). Twig and the panel, nothing else: a framework other than Symfony builds the panel and adds this extension.

What is not the page's (ConsentPanel::IGNORE).

public function __construct(protected readonly ConsentPanel $panel)
public function getFunctions(): array
public function panel(): ConsentPanel
public function options(): array
Returns

see ConsentPanel::options()

public function settings(): array
Returns

see ConsentPanel::settings()

public function json(): string