vlad-planet/yii2-blog

User Blog for yii2

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Language:JavaScript

Type:yii2-extension

dev-master 2019-02-23 03:35 UTC

This package is not auto-updated.

Last update: 2025-06-09 08:55:59 UTC


README

User Blog for yii2

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist vlad-planet/yii2-blog "*"

or add

"vlad-planet/yii2-blog": "*"

to the require section of your composer.json file.

!!! Configurations

common\config\main.php

'modules' => [
	'blog' => [
	'class' => vladplanet\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`)
],

frontend\config\main.php

'modules' => [
	'blog' => [
	'class' => 'vladplanet\blog\Module',
	'controllerNamespace' => 'vladplanet\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'
            ]
        ]
    ],

'bootstrap' => [
	'log',
	'vladplanet\blog\Bootstrap',
],

backend\config\main.php

'bootstrap' => [
	'log',
	'vladplanet\blog\Bootstrap',
],
	
'modules' => [
	'blog' => [
		'class' => 'vladplanet\blog\Module',
		'controllerNamespace' => 'vladplanet\blog\controllers\backend',
		//'adminAccessControl' => 'common\components\AdminAccessControl', // null - by default 
	],
],

url

http://yii2.local/blog http://yii2.local/admin/blog

Usage

Once the extension is installed, simply use it in your code by :

<?= \vladplanet\blog\AutoloadExample::widget(); ?>```