Development
The package renders every example of Components as a page that opens in a browser, so a component can be seen while it is written.
The Examples
The examples are the files tests/fixtures/examples/block-*.html.twig, one per component, with the data that the component can have. The tests render them with the strict mode of Twig in a Symfony kernel. The images they use are in tests/fixtures/examples/assets.
The Pages
Running the tests of the examples saves, next to each example, an HTML page with its name:
vendor/bin/phpunit --filter ExamplesTest
tests/fixtures/examples/block-alert.html.twig gives tests/fixtures/examples/block-alert.html. The pages are not versioned.
Each page has Bootstrap 5 and Font Awesome 6 from a CDN, the HTML of the component, and a link to resources/css/components.css of the package by a relative path, so a change in the CSS is seen by reloading the page. The page opens from the file system.
The Videos
The embeds of YouTube do not load from file:// (they show the error 153, “Video player configuration error”): they need a page that is served by HTTP. Serve the directory of the package and open the page by its path:
php -S localhost:8000
http://localhost:8000/tests/fixtures/examples/block-video.html.
The Quality of the Code
composer phpstan # PHPStan, level 9.
composer phpcs # The code style.
composer tests # PHPUnit, with the coverage.