wdmg/yii2-news

News manager

Installs: 32

Dependents: 1

Suggesters: 0

Security: 0

Stars: 2

Watchers: 3

Forks: 2

Open Issues: 0

Type:yii2-extension

1.0.7 2020-01-18 23:12 UTC

This package is auto-updated.

Last update: 2020-02-16 16:52:39 UTC


README

Yii2 Github all releases Progress GitHub license GitHub release

Yii2 News

News module for Yii2

Requirements

Installation

To install the module, run the following command in the console:

$ composer require "wdmg/yii2-news"

After configure db connection, run the following command in the console:

$ php yii news/init

And select the operation you want to perform:

  1. Apply all module migrations
  2. Revert all module migrations

Migrations

In any case, you can execute the migration and create the initial data, run the following command in the console:

$ php yii migrate --migrationPath=@vendor/wdmg/yii2-news/migrations

Configure

To add a module to the project, add the following data in your configuration file:

'modules' => [
    ...
    'news' => [
        'class' => 'wdmg\news\Module',
        'routePrefix' => 'admin',
        'newsRoute'  => '/news', // route for frontend (string or array), use "/" - for root
        'newsLayout' => '@app/views/layouts/main', // the default layout to render news
        'newsImagePath' => '/uploads/news' // the default path to save news thumbnails in @webroot
    ],
    ...
],

Routing

Use the Module::dashboardNavItems() method of the module to generate a navigation items list for NavBar, like this:

<?php
    echo Nav::widget([
    'options' => ['class' => 'navbar-nav navbar-right'],
        'label' => 'Modules',
        'items' => [
            Yii::$app->getModule('news')->dashboardNavItems(),
            ...
        ]
    ]);
?>

Status and version [ready to use]

  • v.1.0.7 - Image save bugfix
  • v.1.0.6 - Added support for RSS-feed, Yandex.Turbo and Google AMP modules
  • v.1.0.5 - Added support for Sitemap module