{"id":20253152,"url":"https://github.com/becklyn/schema-org","last_synced_at":"2025-04-10T23:32:40.638Z","repository":{"id":62492754,"uuid":"268844185","full_name":"Becklyn/schema-org","owner":"Becklyn","description":"A Symfony bundle to render Schema.org compatible JSON-LD meta data","archived":false,"fork":false,"pushed_at":"2022-02-17T15:56:08.000Z","size":153,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"1.x","last_synced_at":"2025-04-08T16:06:59.238Z","etag":null,"topics":["json-ld","schema-org","seo","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Becklyn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2020-06-02T15:52:45.000Z","updated_at":"2025-02-11T23:54:57.000Z","dependencies_parsed_at":"2022-11-02T09:45:32.589Z","dependency_job_id":null,"html_url":"https://github.com/Becklyn/schema-org","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Becklyn%2Fschema-org","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Becklyn%2Fschema-org/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Becklyn%2Fschema-org/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Becklyn%2Fschema-org/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Becklyn","download_url":"https://codeload.github.com/Becklyn/schema-org/tar.gz/refs/heads/1.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248316837,"owners_count":21083515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json-ld","schema-org","seo","symfony","symfony-bundle"],"created_at":"2024-11-14T10:21:42.626Z","updated_at":"2025-04-10T23:32:40.612Z","avatar_url":"https://github.com/Becklyn.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Becklyn Schema.org Bundle\n=========================\n\nThis bundle provides a thin integration for rendering Schema.org-compatible JSON-LD meta data tags.\n\n\nCreating a schema\n=================\n\nBefore you can render the meta data inside your templates, you need to implement a `SchemaBuilderInterface` for each entity type, that you want to generate a JSON-LD schema for.\n\nAn example `SchemaBuilderInterface` implementation would look like this, which would convert an `MyNewsArticle` into a Schema.org `Article`.\n\n\n```php\nuse App\\Entity\\MyNewsArticle;\nuse Becklyn\\SchemaOrg\\Data\\Article;\nuse Becklyn\\SchemaOrg\\Data\\Organization;\nuse Becklyn\\SchemaOrg\\Data\\SchemaOrgDataInterface;\nuse Becklyn\\SchemaOrg\\SchemaBuilder\\SchemaBuilderInterface;\n\nclass MyNewsSchemaBuilder implements SchemaBuilderInterface\n{\n    /**\n     * @inheritDoc\n     */\n    public function supports ($entity, ?string $usage = null, array $context = []) : bool\n    {\n        return $entity instanceof MyNewsArticle;\n    }\n\n\n    /**\n     * @inheritDoc\n     */\n    public function buildSchema ($entity, ?string $usage = null, array $context = []) : ?SchemaOrgDataInterface\n    {\n        \\assert($entity instanceof MyNewsArticle);\n\n        // Don't generate metadata for unpublished news\n        if (!$entity-\u003eisPublished())\n        {\n            return null;\n        }\n\n        return (new Article())\n            -\u003ewithEditor($entity-\u003egetAuthor())\n            -\u003ewithAbout($entity-\u003egetTeaserText())\n            -\u003ewithArticleBody($entity-\u003egetTextContent())\n            -\u003ewithPublisher(\n                (new Organization())\n                    -\u003ewithName(\"Awesome Publisher\")\n                    -\u003ewithEmail(\"news@example.com\")\n            )\n            -\u003ewithLicense(\"Creative Commons Attribution-ShareAlike 3.0\")\n        ;\n    }\n}\n```\n\n\nRender meta data tag\n====================\n\nTo render the JSON-LD meta data tag, call the Twig function `{{ schema_org_meta_data(myAppEntity) }}` and pass in an optional `usage` and `context` parameter,\nif you need to tweak the output based on the current render context.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecklyn%2Fschema-org","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbecklyn%2Fschema-org","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecklyn%2Fschema-org/lists"}