{"id":20375269,"url":"https://github.com/cba85/php-seo-tag","last_synced_at":"2026-05-07T20:41:29.587Z","repository":{"id":62500267,"uuid":"109302324","full_name":"cba85/php-seo-tag","owner":"cba85","description":"🌍 A php package to add metadata tags for search engines and social networks to better index and display your site's content.","archived":false,"fork":false,"pushed_at":"2021-08-16T08:20:04.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-03T03:39:51.529Z","etag":null,"topics":["composer","json-ld","open-graph","package","php","search-engine-optimization","seo","social-media"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cba85.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-02T18:16:04.000Z","updated_at":"2023-02-17T12:08:33.000Z","dependencies_parsed_at":"2022-11-02T11:47:07.989Z","dependency_job_id":null,"html_url":"https://github.com/cba85/php-seo-tag","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cba85/php-seo-tag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cba85%2Fphp-seo-tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cba85%2Fphp-seo-tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cba85%2Fphp-seo-tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cba85%2Fphp-seo-tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cba85","download_url":"https://codeload.github.com/cba85/php-seo-tag/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cba85%2Fphp-seo-tag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32755579,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["composer","json-ld","open-graph","package","php","search-engine-optimization","seo","social-media"],"created_at":"2024-11-15T01:29:33.893Z","updated_at":"2026-05-07T20:41:29.550Z","avatar_url":"https://github.com/cba85.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP SEO tag\n\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n\nA PHP package inspired by [jekyll-seo-tag](https://github.com/jekyll/jekyll-seo-tag) to add metadata tags for search engines and social networks to better index and display your site's content.\n\n## What it does\n\nPHP SEO Tag adds the following meta tags to your site:\n\n- Page title\n- Page description\n- Canonical URL\n- Next and previous URLs on paginated pages\n- [JSON-LD Site and post metadata](https://developers.google.com/search/docs/guides/intro-structured-data) for richer indexing\n- [Open Graph](http://ogp.me) title, description, site title, and URL (for Facebook, LinkedIn, etc.)\n- [Twitter Summary Card](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started) metadata\n\nPHP SEO tag isn't designed to accommodate every possible use case. It should work for most site out of the box and without a laundry list of configuration options that serve only to confuse most users.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require cba85/php-seo-tag\n```\n\n## Usage\n\n```php\nuse Seo\\Tag as Seo;\n\n$tags = []; // Your tags\n$seoTag = new Seo($tags);\n$seo = $seoTag-\u003erender();\n```\n\nThe package will return the HTML metatags depending of your parameters.\n\nYou then just have to display the `$seo` variable.\n\n```php\necho $seo;\n```\n\nYou'll find an example in the example folder.\n\n### Multiples array\n\nYou can pass as parameters how many arrays containing your tags as you want. The package will merge them. It could be useful if you want to separate general tags of your website and specific tags of your page.\n\n```php\n$siteTags = []; // General tags of your website\n$pageTags = []; // Tags of your page\n$seotag = new SeoTag($siteTags, $pageTags);\n$seo = $seotag-\u003erender();\n```\n\nYou'll find an example of this in the example folder.\n\n### Tags\n\nThe SEO tag will respect any of the following if included the `$tags` array (and simply not include them if they're not defined):\n\n- `site_title` - Your site's title (e.g., My awesome website)\n\n    ```php\n    $tags['site_title'] =\u003e \"The title of the website\";\n    ```\n\n- `page_title` - Your page's title (e.g., About)\n\n    ```php\n    $tags['page_title'] =\u003e \"The title of the page\";\n    ```\n\n- `description` - A short description (e.g., A blog dedicated to reviewing cat gifs)\n\n    ```php\n    $tags['description'] =\u003e \"The description of the page\";\n    ```\n\n- `url` - The full URL to your site.\n\n    ```php\n    $tags['url'] =\u003e \"https://www.example.com\";\n    ```\n\n- `date` - The date your page was published.\n\n    ```php\n    $tags['date'] =\u003e \"2017-11-05 18:00:00\";\n    ```\n\n    - `date_modified` and `date_published` - You can manually specify the date modified and date published.\n\n    This field will take first priority for the dateModified JSON-LD output. This is useful when the file timestamp does not match the true time that the content was modified.\n\n    ```php\n    $tags['date'] =\u003e [\n        'published' =\u003e \"2017-11-02 12:30:00\",\n        'modified' =\u003e \"2017-11-03 15:01:00\",\n    ];\n    ```\n\n- `author` - Author name\n\n    ```php\n    $tags['author'] =\u003e \"Clement\";\n    ```\n\n- `twitter` - The site's Twitter handle.\n\n    ```php\n    $tags['twitter'] =\u003e \"@jack\";\n    ```\n\n- `facebook` - The following properties are available:\n  - `app_id` - a Facebook app ID for Facebook insights\n  - `publisher` - a Facebook page URL or ID of the publishing entity\n  - `admins` - a Facebook user ID for domain insights linked to a personal account\n\n  You'll want to describe one or more like so:\n\n    ```php\n    $tags['facebook'] =\u003e [\n        'admins' =\u003e \"Mark\",\n        'publisher' =\u003e \"Priscilla\",\n        'app_id' =\u003e \"123456789\",\n    ];\n    ```\n\n- `image` - URL to a site-wide logo (e.g., `/assets/img/your-company-logo.png`)\n\n    ```php\n    $tags['image'] =\u003e \"/img/image.jpg\";\n    ```\n\n    For most users, setting `$tags['image'] =\u003e \"path-to-image\"` on a per-page basis should be enough. If you need more control over how images are represented, the `image` property can also be an object, with the following options:\n\n    * `path` - The relative path to the image. Same as `$tags['image'] =\u003e \"path-to-image\"`\n    * `height` - The height of the Open Graph (`og:image`) image\n    * `width` - The width of the Open Graph (`og:image`) image\n\n    You can use any of the above, optional properties, like so:\n\n    ```php\n    $tags['image'] =\u003e [\n        'path' =\u003e \"/img/image.jpg\",\n        'height' =\u003e \"350\",\n        'width' =\u003e \"250\",\n    ];\n    ```\n\n- `social` - For [specifying social profiles](https://developers.google.com/structured-data/customize/social-profiles).\n\n    ```php\n    $tags['social'] =\u003e [\n            \"https://twitter.com/user\",\n            \"https://www.facebook.com/user\",\n            \"https://www.linkedin.com/in/user\",\n            \"https://github.com/user\",\n            \"https://medium.com/@user\",\n        ];\n    ```\n\n- `google_site_verification` for verifying ownership via Google webmaster tools\nAlternatively, verify ownership with several services at once using the following format:\n\n    ```php\n    $tags['webmaster_verifications'] =\u003e [\n            'google' =\u003e \"123456789\",\n            'bing' =\u003e \"123456789\",\n            'alexa' =\u003e \"123456789\",\n            'yandex' =\u003e \"123456789\",\n        ];\n    ```\n\n- `lang` - The locale these tags are marked up in. Of the format `language_TERRITORY`. Default is `en_US`.\n\n    ```php\n    $tags['lang'] =\u003e \"fr_FR\";\n    ```\n\n-  `type` - The type of things that the page represents. This must be a [Schema.org type](http://schema.org/docs/schemas.html), and will probably usually be something like [`BlogPosting`](http://schema.org/BlogPosting), [`NewsArticle`](http://schema.org/NewsArticle), [`Person`](http://schema.org/Person), [`Organization`](http://schema.org/Organization), etc.\n\n    ```php\n    $tags['type'] =\u003e \"WebSite\";\n    ```\n\n- `generator` - The generator of your website.\n\n    ```php\n     $tags['generator'] =\u003e \"My awesome framework\";\n    ```\n\n- `canonical_url` - You can set custom Canonical URL for a page by specifying canonical_url option. If no canonical_url option was specified, then uses page url for generating canonical_url.\n\n    ```php\n    $tags['canonical_url'] =\u003e \"https://www.example.com\";\n    ```\n\n- `previous_page` and `next_page` - Next and previous URLs on paginated pages.\n\n    ```php\n    $tabs['previous_page'] =\u003e \"https://www.example.com/post/1\";\n    $tabs['next_page'] =\u003e \"https://www.example.com/post/2\";\n    ```\n\n## Testing\n\nNo unit test yet.\n\n## Credits\n\n- [cba85](https://github.com/cba85)\n\n## License\n\nPlease see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcba85%2Fphp-seo-tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcba85%2Fphp-seo-tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcba85%2Fphp-seo-tag/lists"}