PHPackages                             cba85/php-seo-tag - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. cba85/php-seo-tag

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cba85/php-seo-tag
=================

A PHP package to add metadata tags for search engines and social networks to better index and display your site's content.

1.0.0(4y ago)1151MITPHPPHP &gt;=7.3CI failing

Since Aug 15Pushed 4y ago1 watchersCompare

[ Source](https://github.com/cba85/php-seo-tag)[ Packagist](https://packagist.org/packages/cba85/php-seo-tag)[ Docs](https://github.com/cba85/php-seo-tag/)[ RSS](/packages/cba85-php-seo-tag/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

PHP SEO tag
===========

[](#php-seo-tag)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

A 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.

What it does
------------

[](#what-it-does)

PHP SEO Tag adds the following meta tags to your site:

- Page title
- Page description
- Canonical URL
- Next and previous URLs on paginated pages
- [JSON-LD Site and post metadata](https://developers.google.com/search/docs/guides/intro-structured-data) for richer indexing
- [Open Graph](http://ogp.me) title, description, site title, and URL (for Facebook, LinkedIn, etc.)
- [Twitter Summary Card](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started) metadata

PHP 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.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require cba85/php-seo-tag
```

Usage
-----

[](#usage)

```
use Seo\Tag as Seo;

$tags = []; // Your tags
$seoTag = new Seo($tags);
$seo = $seoTag->render();
```

The package will return the HTML metatags depending of your parameters.

You then just have to display the `$seo` variable.

```
echo $seo;
```

You'll find an example in the example folder.

### Multiples array

[](#multiples-array)

You 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.

```
$siteTags = []; // General tags of your website
$pageTags = []; // Tags of your page
$seotag = new SeoTag($siteTags, $pageTags);
$seo = $seotag->render();
```

You'll find an example of this in the example folder.

### Tags

[](#tags)

The SEO tag will respect any of the following if included the `$tags` array (and simply not include them if they're not defined):

- `site_title` - Your site's title (e.g., My awesome website)

    ```
    $tags['site_title'] => "The title of the website";
    ```
- `page_title` - Your page's title (e.g., About)

    ```
    $tags['page_title'] => "The title of the page";
    ```
- `description` - A short description (e.g., A blog dedicated to reviewing cat gifs)

    ```
    $tags['description'] => "The description of the page";
    ```
- `url` - The full URL to your site.

    ```
    $tags['url'] => "https://www.example.com";
    ```
- `date` - The date your page was published.

    ```
    $tags['date'] => "2017-11-05 18:00:00";
    ```

    - `date_modified` and `date_published` - You can manually specify the date modified and date published.

    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.

    ```
    $tags['date'] => [
        'published' => "2017-11-02 12:30:00",
        'modified' => "2017-11-03 15:01:00",
    ];
    ```
- `author` - Author name

    ```
    $tags['author'] => "Clement";
    ```
- `twitter` - The site's Twitter handle.

    ```
    $tags['twitter'] => "@jack";
    ```
- `facebook` - The following properties are available:

    - `app_id` - a Facebook app ID for Facebook insights
    - `publisher` - a Facebook page URL or ID of the publishing entity
    - `admins` - a Facebook user ID for domain insights linked to a personal account

    You'll want to describe one or more like so:

    ```
    $tags['facebook'] => [
        'admins' => "Mark",
        'publisher' => "Priscilla",
        'app_id' => "123456789",
    ];
    ```
- `image` - URL to a site-wide logo (e.g., `/assets/img/your-company-logo.png`)

    ```
    $tags['image'] => "/img/image.jpg";
    ```

    For most users, setting `$tags['image'] => "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:

    - `path` - The relative path to the image. Same as `$tags['image'] => "path-to-image"`
    - `height` - The height of the Open Graph (`og:image`) image
    - `width` - The width of the Open Graph (`og:image`) image

    You can use any of the above, optional properties, like so:

    ```
    $tags['image'] => [
        'path' => "/img/image.jpg",
        'height' => "350",
        'width' => "250",
    ];
    ```
- `social` - For [specifying social profiles](https://developers.google.com/structured-data/customize/social-profiles).

    ```
    $tags['social'] => [
            "https://twitter.com/user",
            "https://www.facebook.com/user",
            "https://www.linkedin.com/in/user",
            "https://github.com/user",
            "https://medium.com/@user",
        ];
    ```
- `google_site_verification` for verifying ownership via Google webmaster tools Alternatively, verify ownership with several services at once using the following format:

    ```
    $tags['webmaster_verifications'] => [
            'google' => "123456789",
            'bing' => "123456789",
            'alexa' => "123456789",
            'yandex' => "123456789",
        ];
    ```
- `lang` - The locale these tags are marked up in. Of the format `language_TERRITORY`. Default is `en_US`.

    ```
    $tags['lang'] => "fr_FR";
    ```
- `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.

    ```
    $tags['type'] => "WebSite";
    ```
- `generator` - The generator of your website.

    ```
     $tags['generator'] => "My awesome framework";
    ```
- `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.

    ```
    $tags['canonical_url'] => "https://www.example.com";
    ```
- `previous_page` and `next_page` - Next and previous URLs on paginated pages.

    ```
    $tabs['previous_page'] => "https://www.example.com/post/1";
    $tabs['next_page'] => "https://www.example.com/post/2";
    ```

Testing
-------

[](#testing)

No unit test yet.

Credits
-------

[](#credits)

- [cba85](https://github.com/cba85)

License
-------

[](#license)

Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1730d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f8dae5dac31d448b3ae83800c9c084dd576e2c5ef16b6313710048b2904c5db?d=identicon)[cba85](/maintainers/cba85)

---

Top Contributors

[![cba85](https://avatars.githubusercontent.com/u/720547?v=4)](https://github.com/cba85 "cba85 (11 commits)")

---

Tags

composerjson-ldopen-graphpackagephpsearch-engine-optimizationseosocial-mediaphppackageseosocial mediaopen-graphsearch engine optimization

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cba85-php-seo-tag/health.svg)

```
[![Health](https://phpackages.com/badges/cba85-php-seo-tag/health.svg)](https://phpackages.com/packages/cba85-php-seo-tag)
```

###  Alternatives

[devrabiul/laravel-seo-manager

Laravel SEO Manager is an SEO tool that improves SEO by adding recommended meta tags.

404.8k](/packages/devrabiul-laravel-seo-manager)[larament/seokit

A complete SEO package for Laravel, covering everything from meta tags to social sharing and structured data.

411.9k](/packages/larament-seokit)[umanskyi31/opengraph

Created a new component for Yii2. The Open Graph component for your website

119.7k](/packages/umanskyi31-opengraph)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
