omnibridge / demo
omnibase's demonstration, a package a site installs or not: the `demo` environment - declared accounts one per role, reset every night (demo:reset), the sign-in page's note, a back office kept to its own accounts, no page indexed, no e-mail sent -, its classes under omnibase's Base\ names (Base\Demo
Requires
- php: ^8.4
- omnisense/omnibase: ^7.4
Requires (Dev)
- omnibridge/doctrine: ^4.0
- omnibridge/symfony: ^3.4
- omnisense/omniauth: ^1.0
- phpunit/phpunit: ^11.5
- symfony/lock: ^7.0|^8.0
- symfony/mailer: ^7.0|^8.0
Suggests
- doctrine/doctrine-fixtures-bundle: demo:reset reloads the fixtures
- omnibridge/laravel: The demonstration under Laravel: its middleware, mail transport, one-click route and demo:reset (^2.1)
- omnibridge/symfony: The demonstration under Symfony: its subscribers (noindex, no e-mail, the back office's secrets), the one-click route, demo:reset, the guard at boot (^3.4)
- omnipack/admin: The back office's « Démonstration » screen (which accounts may sign in) and its banner
- symfony/lock: demo:reset runs under a lock: two resets never run at once
Provides
None
Conflicts
None
Replaces
None
README
omnibase's demonstration as a package a site installs or not: APP_ENV=demo runs the site as a
demonstration - production's behaviour, a database of its own, accounts that are always there (one for each
role of the trade), reset every night - and keeps from its visitors what a public demonstration must keep: no page
indexed, no e-mail sent, a back office open to its own accounts alone.
composer require omnibridge/demo
It was omnisense/omnibase's until 8.0, which moved it out (a decision of Marco's: a site that is no demonstration
carries nothing of it). Its classes keep omnibase's names, the portable Base\ + App\ convention:
Base\Demo\*:DemoMode(thedemoenvironment),DemoAccount,DemoAccountProviderInterface(what a bundle or the application declares),DemoAccountRegistry,DemoAccountFactory(the declarations as rows),DemoAccountLock(what an account keeps),DemoGuard(no debug, never the production database),DemoSecrets(what an account signs in with),DemoSwitches(the back office's « Démonstration » screen),DemoSafeguards(indexing, e-mails, the back office),DemoSignIn(the one-click sign-in's rule);Base\Auth\DemoPasswords(omniauth's passwords in a demonstration),Base\View\DemoandBase\Twig\Extension\DemoTwigExtension(demo_mode(),demo_accounts(),demo_sign_in_accounts(),demo_identifier_passwords()),Base\Console\Task\DemoReset(demo:reset),Base\Exception\DemoRefusedException;- the templates
@Base/demo/_notice.html.twig(the sign-in page's note),_accounts.html.twig(its former name) and_banner.html.twig, rewritten by a site undertemplates/bundles/BaseBundle/demo/; thedemocatalogue; - the options
base.demo.*(src/Resources/options.php), which the core's schema reads where the package is installed, and its services (src/Resources/services/demo.php), the core's group "demo".
The package is framework-free. What a framework answers - its events, its sign-in form, its console, its routes -
is hooked by its bridge where the package is installed, guarded by class_exists(): omnibridge/symfony (the
subscribers, the one-click route, demo:reset, the guard at boot), omnibridge/laravel (the middleware, the mail
transport, the one-click route, demo:reset), omnibridge/doctrine and omnibridge/eloquent (the account lock on
their unit of work), omnipack/admin (the « Démonstration » screen, the banner). Each piece has one owner: the rules
here, each host's glue in its bridge.
On or off is the package itself, like a debug bundle: the demonstration is on where omnibridge/demo is installed
and the site runs APP_ENV=demo, and nowhere else. composer remove omnibridge/demo turns it off - the site, in
demo too, then has nothing of it: no banner nor note, no header, its e-mails sent, its back office as usual, no
demo:reset, no « Démonstration » screen. Install it only on the sites that are shown as a demonstration. Which
declared accounts may sign in is the back office's « Démonstration » screen (DemoSwitches).
The documentation: docs/demo.md.
Tests
The kernel tests boot the host application - the omnibase harness (demo test, this package mounted over
vendor/omnibridge/demo, HARNESS_SUITE_BOOTSTRAP=vendor/omnibridge/demo/tests/bootstrap.php) or a site's suite -
and are skipped without it; the others run alone.