2017 © Pedro Peláez
 

yii2-extension yii2-blog-tools

Blog tools. Posts, Authors, Users, Tags, Rubrics, Comments backend SBAdmin-panel management.

image

sergmoro1/yii2-blog-tools

Blog tools. Posts, Authors, Users, Tags, Rubrics, Comments backend SBAdmin-panel management.

  • Friday, July 20, 2018
  • by sergmoro1
  • Repository
  • 1 Watchers
  • 0 Stars
  • 88 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 7 % Grown

The README.md

Yii2 module for backend blog management, SBadmin panel, advanced template

Ordinary management system for posts. Can be used as a base for any app., (*1)

Advantages

  • Posts, nested set rubrics, tags, users, authors;
  • Comments management, update, reply;
  • Imperavi redactor;
  • Files & images uploading, photos chain for carousel slider;
  • User registration with email confirmation or by network account;
  • RBAC.

Installation

  1. Install package

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

composer require --prefer-dist sergmoro1/yii2-blog-tools, (*4)

or add, (*5)

"sergmoro1/yii2-blog-tools": "^1.1", (*6)

to the require section of your composer.json., (*7)

  1. Git init

git init, (*8)

  1. Configuring migrations

Add information about migration folders with namespace to console\config\main.php in controllerMap section., (*9)

    'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationNamespaces' => [
                'sergmoro1\uploader\migrations',
                'sergmoro1\lookup\migrations',
                'sergmoro1\user\migrations',
                'sergmoro1\blog\migrations',
                'sergmoro1\comment\migrations',
            ],
        ],
    ],
  1. Run migrations
php yii migrate
php yii migrate --migrationPath=@vendor/notgosu/yii2-meta-tag-module/src/migrations
  1. Init blog

Copy predefined files to appropriate folders by batch file initblog., (*10)

To get it make a command in app directory., (*11)

cp ./vendor/sergmoro1/yii2-blog-tools/src/initblog ./, (*12)

And run a batch file., (*13)

php initblog, (*14)

Set the folder as writable to store the uploaded files., (*15)

chmod -R 777 ./frontend/web/files, (*16)

Configuration

Set up in backend/config/main.php., (*17)

return [
    'defaultRoute' => '/blog/site/index',
    'layoutPath' => '@vendor/sergmoro1/yii2-blog-tools/src/views/layouts',
    'modules' => [
        'uploader' => ['class' => 'sergmoro1\uploader\Module'],
    ],
    'components' => [
        'authManager' => [
            'class' => 'yii\rbac\PhpManager',
            'defaultRoles' => ['commentator', 'author', 'admin'],
            'itemFile' => __DIR__ . '/../../console/rbac/items.php',
            'ruleFile' => __DIR__ . '/../../console/rbac/rules.php',
        ],
        'user' => [
            'class' => 'yii\web\User',
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
        ],
        'urlManager' => [
            'class' => 'yii\web\UrlManager',
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'enableStrictParsing' => false,
        ],
        'errorHandler' => [
            'errorAction' => '/blog/site/error',
        ],
    ],
];

Set up in common/config/main.php., (*18)

return [
    'language' => 'ru-RU', // 'en-US',
    'bootstrap' => [
        'blog',
        'comment',
    ],
    'modules' => [
        'lookup'        => ['class' => 'sergmoro1\lookup\Module'],
        'blog'          => ['class' => 'sergmoro1\blog\Module'],
        'comment'       => ['class' => 'sergmoro1\comment\Module'],
        'user'          => ['class' => 'sergmoro1\user\Module'],
        'seo'           => ['class' => 'notgosu\yii2\modules\metaTag\Module'],
    ],
    'components' => [
        'authManager' => [
            'class' => 'yii\rbac\PhpManager',
        ],
        'user' => [
            'class' => 'yii\web\User',
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'useFileTransport' => false,
            'viewPath' => '@vendor/sergmoro1/yii2-user/src/mail',
            /* Definition of Yandex post office for your domain (example).
            'transport' => [
                'class' => 'Swift_SmtpTransport',
                'host' => 'smtp.yandex.ru',
                'username' => 'admin@your-site.ru',
                'password' => 'your-password',
                'port' => '465',
                'encryption' => 'ssl',
            ],
            */
        ],
        'i18n' => [
            'translations' => [
                'app*' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'basePath' => '@app/../messages',
                    'sourceLanguage' => 'en-US',
                    'fileMap' => [
                        'app' => 'app.php',
                        'app/error' => 'error.php',
                    ],
                ],
                'metaTag' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                ],
                // sergmoro1/user/models/LoginForm is used in frontend/controllers/SiteController, so
                // it is not used within the Module then translation should be defined twice
                // here and in a sergmoro1/user/Module::registerTranslations()
                'sergmoro1/user/*' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'sourceLanguage' => 'en-US',
                    'basePath' => '@vendor/sergmoro1/yii2-user/src/messages',
                    'fileMap' => [
                        'sergmoro1/user/core' => 'core.php',
                    ],
                ],
            ],
        ],
    ],
];

Set up in common/config/params-local.php., (*19)

return [
    // localhost or real host
    'frontend' => 'http://localhost',
];

Don't forget add .htaccess file to backend/web and frontend/web., (*20)

Start

Enter http://your-app/backend/web and Login., (*21)

Name: Admin, (*22)

Password: 123456, (*23)

The Versions