PHPackages                             rikipm/yii2-oggenerator - 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. rikipm/yii2-oggenerator

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

rikipm/yii2-oggenerator
=======================

Yii2 OpenGraph tags generator

1.0.4(6y ago)02[1 issues](https://github.com/rikipm/yii2-oggenerator/issues)MITPHP

Since May 18Pushed 6y ago1 watchersCompare

[ Source](https://github.com/rikipm/yii2-oggenerator)[ Packagist](https://packagist.org/packages/rikipm/yii2-oggenerator)[ RSS](/packages/rikipm-yii2-oggenerator/feed)WikiDiscussions master Synced 2mo ago

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

yii2-oggenerator
================

[](#yii2-oggenerator)

Its simple Yii2 component that generates [OpenGraph](http://ogp.me/) tags for your models pages

Installation
============

[](#installation)

The preferred way to install this extension is through composer.

Either run

```
composer require --prefer-dist "rikipm/yii2-oggenerator" "*"

```

or add

```
"rikipm/yii2-oggenerator" : "*"

```

to the require section of your application's `composer.json` file.

Usage
=====

[](#usage)

Add new component to `components` section of your application config and configure it

```
'oggenerator'=>[
            'class' => 'rikipm\oggenerator',

            'locale' => 'en-US', //Its "og:locale" tag for all pages
            'site_name' => 'MySite',  //Its "og:site_name" tag for all pages

            'attr_title' => 'title',
            'attr_type' => 'type',
            'attr_image' => 'image',
            'attr_image_alt' => 'image_alt',
            'attr_description' => 'description',
        ],
```

`attr_` options will determine what attribute from model will be used for content of tag. In example `'og:title'` will assigned `$model->title` value, `'og:image'` will assigned `$model->image` value, etc.

`og:url` ,`og:image:type`, `og:image:width` and `og:image:height` tags will be generated automatically.

In controller that display your page add `Yii::$app->oggenerator->generate($model);`

For example:

```
public function actionView($id)
{
  $model = Model::findOne(['id' => $id]);

  Yii::$app->oggenerator->generate($model);
  return $this->render('view', ['model' => $model]);
}
```

**Attention!**

`og:image` must be **absolute** url. You can use getters in model class to generate value

For example:

```
public getImage()
{
  return Url::home().'/upload/'.$model->image_file;
}
``
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

Every ~79 days

Total

3

Last Release

2393d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f10fa98fe3e8b8b7749fd58be6f5d2fc2c6410e5b24d841b9876278ceaf1d9d1?d=identicon)[rikipm](/maintainers/rikipm)

---

Top Contributors

[![rikipm](https://avatars.githubusercontent.com/u/13685393?v=4)](https://github.com/rikipm "rikipm (32 commits)")

---

Tags

yii2opengraph

### Embed Badge

![Health badge](/badges/rikipm-yii2-oggenerator/health.svg)

```
[![Health](https://phpackages.com/badges/rikipm-yii2-oggenerator/health.svg)](https://phpackages.com/packages/rikipm-yii2-oggenerator)
```

###  Alternatives

[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[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)
