krystal-sf / ux-metadata
Page Metadata Management for Krystal Symfony Projects
Package info
gitlab.com/krystal-sf/ux-metadata
Type:symfony-bundle
pkg:composer/krystal-sf/ux-metadata
Requires
- php: ^8.1
- krystal-sf/plugin-manager: ^1.0
- krystal-sf/ux-blocks: ^1.0
- krystal-sf/ux-common: ^1.0
Requires (Dev)
- badpixxel/php-sdk: ^3.0
- krystal-sf/ux-bootstrap-5: ^1.0
- krystal-sf/ux-menus: ^1.0
- krystal-sf/ux-prism: ^1.0
- phpunit/phpunit: ^10.0|^11.0
- symfony/debug-bundle: ^6.4|^7.4|^8.0
- symfony/monolog-bundle: ^3.0|^4.0
- symfony/stopwatch: ^6.4|^7.4|^8.0
- symfony/web-profiler-bundle: ^6.4|^7.4|^8.0
This package is auto-updated.
Last update: 2026-08-05 09:30:11 UTC
README
Page metadata management for Krystal Symfony Projects: page title, meta tags, canonical & lang alternates — SEO ready.
Installation
composer require krystal-sf/ux-metadata
This bundle is a Krystal Plugin (krystal-sf/plugin-manager) — the
recommended way to enable it is through the Plugin Manager:
bin/console plugin:discover
bin/console plugin:enable ksf_metadata
Alternatively, register it as a regular bundle in config/bundles.php:
return [
// ...
Ksf\Plugins\PageMetadata\KsfMetadataBundle::class => ['all' => true],
];
Usage
Import the trait in your controller, then autoload metadata from translations:
class Index extends AbstractController
{
use PageMetadataAwareTrait;
public function __invoke(): Response
{
$this->autoloadPageMeta("page-metadata.index", "MyDomain");
// or configure manually:
$this->getPageMetadataOrDie()
->setTitle("My Page")
->addTitleSuffix("| My App")
->addMeta("name", "description", "My page description")
->setLinkCanonical("https://my.app/page")
->addLangAlternate("https://my.app/fr/page", "fr")
;
}
}
Rendering
Two Twig Components are registered as Tagged Blocks on the HEADER
location (krystal-sf/ux-blocks) — rendered automatically when your
layout includes the header block:
Ksf:Metadata:Title— the<title>tagKsf:Metadata:Page—<meta>tags, canonical link & lang alternates
Head & html attributes (getHeadAttributes(), getHtmlAttributes()) are
exposed by the PageMetadata service for manual use in custom layouts.
Testing
make up # boot the docker stack
make phpunit # run the test suite
make quality # lint + style + phpstan
License
MIT — see LICENSE.