Download the PHP package mitopp/schema-org-bundle without Composer
On this page you can find all versions of the php package mitopp/schema-org-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mitopp/schema-org-bundle
More information about mitopp/schema-org-bundle
Files in mitopp/schema-org-bundle
Package schema-org-bundle
Short Description A Builder for Schema.org Graph Types
License MIT
Informations about the package schema-org-bundle
Schema.org Bundle for Symfony
[!WARNING] This Bundle is experimental and subject to change in a future release.
This Symfony bundle allows for easy generation and management of Schema.org data in the form of a JSON-LD graph. It provides a central collector service to gather structured data across different parts of your application (controllers, listeners, services) and output it collectively.
Features
- Central collector for Schema.org objects.
- Twig extension for easy rendering of the JSON-LD graph.
- Support for nested objects and references via
@id. - Configurable output (e.g., Pretty Print).
Installation
Install the bundle via Composer:
The bundle should be automatically activated by Symfony Flex. If not, add it manually to your config/bundles.php:
Configuration
You can customize the bundle's behavior in a configuration file (e.g., config/packages/mitopp_schema_org.yaml):
Usage
In the Controller
You can inject the SchemaOrgGraphCollectorInterface directly into your controller to add data:
Via Event Listener
It is often useful to add global data (such as organization or website search) centrally via a listener:
Output in Twig
To output the collected data in your HTML header, use the provided Twig function in your base template (e.g., base.html.twig):
Supported Types
The bundle currently includes several common Schema.org types. For detailed examples and usage instructions, please refer to our documentation.
ThingActionSearchActionCreativeWorkArticleBlogPostingTechArticle
CommentHowToStepMediaObjectImageObject
RecipeReviewWebPageCollectionPageContactPageProfilePage
WebSiteIntangibleItemListBreadcrumbList
ListItemRatingAggregateRating
OrganizationPerson
Creating Custom Types
The bundle already offers some common types. However, you can create your own types at any time by inheriting from AbstractType:
License
This bundle is licensed under the MIT License.