PHP Classes

How Can PHP Set Meta Tags for Pages Using the Extension Yii2 Tagged View: Set page meta and other tags in view scripts

Recommend this page to a friend!
  Info   View files Documentation   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2024-04-26 (2 months ago) RSS 2.0 feedNot enough user ratingsTotal: 20 All time: 11,241 This week: 55Up
Version License PHP version Categories
yii2-taggedview 1.0BSD License5HTML, PHP 5, Libraries, Design Patterns, S...


This package can set page meta and other tags in view scripts.

It provides an extension to the Yii2 framework that allows developers to set some Web page properties as class variables in view scripts.

Currently, it supports page properties like:

- Article meta tag

- Page meta tags author, description, robots, keywords, generator

- Page rel canonical tag

- OpenGraph tags title, url, site_name, type, description, locale, updated_time and image

- Twitter meta tags card, title, URL, creator, site, type, description, label1, data1, label2, and data2

Innovation Award
PHP Programming Innovation award nominee
April 2024
Number 6
Meta tags are useful to define certain page properties that are not visible to users but can be useful for other applications and search engines like Google or social networks like Twitter and Facebook.

Many modern PHP applications use Model-View-Controller (MVC) frameworks that allow developers to define aspects of the presentation of the application pages with view scripts.

This package allows developers to easily set page property meta-tags using view scripts for applications developed using the Yii2 framework.

Manuel Lemos
Picture of Gabriel Alejandro López López
  Performance   Level  
Name: Gabriel Alejandro López ... <contact>
Classes: 8 packages by
Country: United States United States
Age: 35
All time rank: 4362553 in United States United States
Week rank: 358 Up44 in United States United States Up
Innovation award
Innovation award
Nominee: 3x



Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Extension to help setup the standard HTML meta tags besides the ones defined by Opengraph and TwitterCard to contribute to website SEO


The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist daxslab/yii2-taggedview "*"

or add

"daxslab/yii2-taggedview": "*"

to the require section of your composer.json file.


Configure the View component into the main configuration file of your application:

'components' => [
    'view' => [
        'class' => 'daxslab\taggedview\View',
        //configure some default values that will be shared by all the pages of the website
        //if they are not overwritten by the page itself
        'image' => '',


The component will try to set some properties by default:

$this->site_name = Yii::$app->name;
$this->url = Yii::$app->request->baseUrl;
$this->locale = Yii::$app->language;

You can overwrite the content of this tags in every page or in the component configuration.


Once the extension is configured, simply use it in your views by:

    $this->title = 'page title';
    $this->description = 'page description';
    $this->keywords = ['keywords', 'for', 'this', 'page'];
    $this->image = ''; 

Proudly made by Daxslab.

  Files folder image Files  
File Role Description
Accessible without login Plain text file Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file Lic. License text
Accessible without login Plain text file Doc. Documentation
Plain text file View.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:11,241
This week:55Up