PHPackages                             akiraz2/yii2-blog - 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. [Framework](/categories/framework)
4. /
5. akiraz2/yii2-blog

ActiveYii2-extension[Framework](/categories/framework)

akiraz2/yii2-blog
=================

Simple, configurable blog module for Yii2 (post, comment, nested category, tags). + frontend, backend. + SEO! (Opengraph, Schema.org)

1.3.3(5y ago)906.7k↑30%24[3 issues](https://github.com/akiraz2/yii2-blog/issues)MITPHP

Since Apr 8Pushed 5y ago14 watchersCompare

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

READMEChangelog (9)Dependencies (5)Versions (17)Used By (0)

Yii2 Super Blog [![Packagist Version](https://camo.githubusercontent.com/24e089cf1bfd2e3c0756b66f042b60682ff38daa4d307e10e51ba7dcff129bd9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616b6972617a322f796969322d626c6f672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/akiraz2/yii2-blog) [![Total Downloads](https://camo.githubusercontent.com/67ef4ca4843edc4e75b46674d4c37658d6846bc50127513996cef3bc37301005/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616b6972617a322f796969322d626c6f672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/akiraz2/yii2-blog) [![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)
=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#yii2-super-blog---)

Yii2 Super Blog is simple, configured yii2 Module with frontend and backend, cloned from unmaintained repo [funson86/yii2-blog](https://github.com/funson86/yii2-blog), fully reorganized and improved.

Features:
---------

[](#features)

- Blog Post with image banner, **seo** tags, [imperavi redactor 2 widget](https://github.com/yiidoc/yii2-redactor)
- Blog Category (nested) with image banner, seo tags
- Blog Tags
- Blog Comment (can be disabled), with [Math captcha](https://github.com/lesha724/yii2-math-captcha) (can be standard yii2-captcha OR [ReCaptcha2](https://packagist.org/packages/himiklab/yii2-recaptcha-widget))
- email in comments are masked (`a*i*a*@bk.ru`)
- all models has Status (*Inactive*, *Active*, *Archive*)
- Inactive comments are truncated (and strip tags)
- also added **semantic** [OpenGraph](http://ogp.me/)(via yii2 component [dragonjet/yii2-opengraph](https://packagist.org/packages/dragonjet/yii2-opengraph)), [Schema.org](http://schema.org/Article)
- backendControllers can be **protected** by your CustomAccessControl (roles or rbac)
- frontend and backend are translated (i18n)
- url rules with slug (for seo)

> **NOTE:** Module is in initial development. Anything may change at any time. Currently develop new version v2.0 with many improvements and for yii2basic template. @develop branch

Table of Contents
=================

[](#table-of-contents)

1. [Installation](#installation)
2. [Configuration](#configuration)
3. [Usage](#usage)
4. [TODO](#todo)
5. [Support](#support)
6. [Contributing](#contributing)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist akiraz2/yii2-blog "~1.3"

```

or add

```
"akiraz2/yii2-blog": "~1.3"

```

to the require section of your `composer.json` file.

> \*\* Note \*\* If you got composer Error `it does not match your minimum-stability`, please change your composer settings to `"minimum-stability": "dev",`

Configuration
-------------

[](#configuration)

By default, all images from Imperavi-widget module are uploaded to dir `@frontend/web/img/blog/upload`. Be sure, this directory is created manually with proper file permissions (chmod).

Add `'bootstrap' => [\akiraz2\blog\Bootstrap::class],` to your config (common/config/main.php)

Config *common* modules in `common/config/main.php`

```
    'modules' => [
        'blog' => [
            'class' => akiraz2\blog\Module::class,
            'urlManager' => 'urlManager',// 'urlManager' by default, or maybe you can use own component urlManagerFrontend
            'imgFilePath' => '@frontend/web/img/blog/',
            'imgFileUrl' => '/img/blog/',
            'userModel' => \common\models\User::class,
            'userPK' => 'id', //default primary key for {{%user}} table
            'userName' => 'username', //uses in view (may be field `username` or `email` or `login`)
        ],
     ],
```

Config *url rewrite* in `common/config/main.php` (or separately frontend/backend apps)

```
    'timeZone' => 'Europe/Moscow', //time zone affect the formatter datetime format
    'components' => [
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
            ],
        ],
        'formatter' => [ //for the showing of date datetime
            'dateFormat' => 'yyyy-MM-dd',
            'datetimeFormat' => 'yyyy-MM-dd HH:mm:ss',
            'decimalSeparator' => '.',
            'thousandSeparator' => ' ',
            'currencyCode' => 'EUR',
        ],
    ],
```

Config *backend modules* in `backend/config/main.php`

```
    'modules' => [
        'blog' => [
            'class' => 'akiraz2\blog\Module',
            'controllerNamespace' => 'akiraz2\blog\controllers\backend',
            //'adminAccessControl' => 'common\components\AdminAccessControl', // null - by default
        ],
    ],
```

Config *frontend modules* in `frontend/config/main.php`

```
    //'defaultRoute' => 'blog', //set blog as default route
    'modules' => [
        'blog' => [
            'class' => 'akiraz2\blog\Module',
            'controllerNamespace' => 'akiraz2\blog\controllers\frontend',
            'blogPostPageCount' => 6,
            'blogCommentPageCount' => 10, //20 by default
            'enableComments' => true, //false by default
            'schemaOrg' => [ // empty array [] by default!
                'publisher' => [
                    'logo' => '/img/logo.png',
                    'logoWidth' => 191,
                    'logoHeight' => 74,
                    'name' => 'My Company',
                    'phone' => '+1 800 488 80 85',
                    'address' => 'City, street, house'
                ]
            ]
        ],
    ],
```

> **NOTE:** Module Yii2-Blog use model `common\models\User`

### Migration

[](#migration)

> **NOTE:** Module uses table `{{%user}}` with PK `id` (You can use [own user model](#user-model) with table and PK) Make sure you have table before applying these migrations.

Migration run after config module

```
./yii migrate --migrationPath=@akiraz2/blog/migrations
```

or full path:

```
./yii migrate --migrationPath=@vendor/akiraz2/yii2-blog/migrations
```

### Access Url

[](#access-url)

1. backend :  (Empty view)
    - Category :  (create first category)
    - Post :
    - Comment :
    - Tag :
2. frontend :

Usage
-----

[](#usage)

### Overriding views

[](#overriding-views)

When you start using Yii2-blog you will probably find that you need to override the default views provided by the module. Although view names are not configurable, Yii2 provides a way to override views using themes. To get started you should configure your view application component as follows:

```
...
'components' => [
    'view' => [
        'theme' => [
            'pathMap' => [
                '@akiraz2/yii2-blog/views/frontend/default' => '@app/views/blog'
            ],
        ],
    ],
],
...
```

In the above `pathMap` means that every view in `@akiraz2/yii2-blog/views/frontend/default` will be first searched under `@app/views/blog` and if a view exists in the theme directory it will be used instead of the original view.

> **NOTE:** Just copy all necessary views from `@akiraz2/yii2-blog/views/frontend/default` to `@app/views/blog` and change!

### User model

[](#user-model)

You can use own user model, but need configure it in config.php

For example,

```
'modules' => [
       'blog' => [
           'class' => akiraz2\blog\Module::class,
           'userModel' => \common\models\User::class,
           'userPK' => 'id', //default primary key for {{%user}} table
           'userName' => 'username', //uses in view (may be field `username` or `email` or `login`)
       ],
    ],
```

### Imperavi Redactor

[](#imperavi-redactor)

**How to change upload path Imperavi Redactor widget**

Yii2 blog module use imperavi redactor 2 Module  with moduleName "redactorBlog".

> **NOTE:** Embedded Module `redactorBlog` use own UploadController with AccessControl! and only in Backend! and only you don`t override default config

If you want change default config, you should add redactor module manually

Config backend modules in backend/config/main.php

```
    'modules' => [
        'blog' => [
            'class' => 'akiraz2\blog\Module',
            'controllerNamespace' => 'akiraz2\blog\controllers\backend',
            'redactorModule' => 'redactor' // 'redactorBlog' - default, maybe you want use standard module 'redactor' with own config
        ],
        'redactor' => [
            'class' => 'yii\redactor\RedactorModule',
            'uploadDir' => '@frontend/web/img/upload/',
            'uploadUrl' => $params['frontendHost'] . '/img/upload',
            'imageAllowExtensions' => ['jpg', 'png', 'gif', 'svg']
        ],
    ],
```

### CustomAdminAccessControl for backend

[](#customadminaccesscontrol-for-backend)

For example, using [dektrium/yii2-user](https://github.com/dektrium/yii2-user)

```
   'modules' => [
        'blog' => [
            'class' => akiraz2\blog\Module::class,
            ...
            'adminAccessControl' => 'common\components\AdminAccessControl',
            ...
        ],
    ],
```

Create file `common\components\AdminAccessControl.php`

```
   namespace common\components;

   use yii\filters\AccessControl;

   class AdminAccessControl extends AccessControl
   {
       public function init()
       {
           $this->rules[] =[
               'allow' => true,
               'roles' => ['@'],
               'matchCallback' => function () {
                   return \Yii::$app->user->identity->getIsAdmin();
               }
           ];
           parent::init();
       }
   }
```

### Opengraph

[](#opengraph)

Please, add component [dragonjet/yii2-opengraph](https://packagist.org/packages/dragonjet/yii2-opengraph) to your project.

```
php composer.phar require --prefer-dist dragonjet/yii2-opengraph "dev-master"

```

Configuration `common/config/main.php` or `frontend/config/main.php`

```
  'components' => [
      'opengraph' => [
          'class' => 'dragonjet\opengraph\OpenGraph',
      ],
      //....
  ],
```

**How to change captcha in Comments**

Not yet... If you are using Recaptcha2 in your project with my yii2-blog, please PR me! By default, we use [Math captcha](https://github.com/lesha724/yii2-math-captcha)

TODO
----

[](#todo)

- refactoring code (specially BlogCategory, BlogTag)
- create widgets (for backend and frontend)
- translate to many popular languages
- create multilang models
- change default design and styles for frontend blog
- add config Captcha

Support
-------

[](#support)

If you have any questions or problems with Yii2-Blog you can ask them directly by using following email address: `akiraz@bk.ru`.

Please translate to your language! Edit config (or copy to your path) `@vendor/akiraz2/yii2-blog/src/messages/config.php`, add your language and run script:

```
php ./yii message/extract @akiraz2/blog/messages/config.php
```

translate file will be in `@vendor/akiraz2/yii2-blog/src/messages/` or your configured path

Contributing
------------

[](#contributing)

If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome. +PSR-2 style coding. I can apply patch, PR in 2-3 days! If not, please write me `akiraz@bk.ru`

Licensing
---------

[](#licensing)

Yii2-Blog is released under the MIT License. See the bundled [LICENSE.md](LICENSE.md)for details.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~72 days

Recently: every ~214 days

Total

15

Last Release

1942d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/24400393?v=4)[akiraz2](/maintainers/akiraz2)[@akiraz2](https://github.com/akiraz2)

---

Top Contributors

[![akiraz2](https://avatars.githubusercontent.com/u/24400393?v=4)](https://github.com/akiraz2 "akiraz2 (43 commits)")[![funson86](https://avatars.githubusercontent.com/u/6244263?v=4)](https://github.com/funson86 "funson86 (40 commits)")[![gugoan](https://avatars.githubusercontent.com/u/1585443?v=4)](https://github.com/gugoan "gugoan (1 commits)")[![moggiex](https://avatars.githubusercontent.com/u/16717155?v=4)](https://github.com/moggiex "moggiex (1 commits)")[![varp](https://avatars.githubusercontent.com/u/504685?v=4)](https://github.com/varp "varp (1 commits)")[![wirwolf](https://avatars.githubusercontent.com/u/8457572?v=4)](https://github.com/wirwolf "wirwolf (1 commits)")[![xklake](https://avatars.githubusercontent.com/u/8393330?v=4)](https://github.com/xklake "xklake (1 commits)")

---

Tags

articleblogcommentpostyii2yii2-blogyii2-extensionyii2-modulesyii2extensionmoduletagblogcommentsseopostcategoryyii2-blog

### Embed Badge

![Health badge](/badges/akiraz2-yii2-blog/health.svg)

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

###  Alternatives

[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.6k47](/packages/skeeks-cms)

PHPackages © 2026

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