2017 © Pedro Peláez
 

yii2-extension yii2-blog-mongodb

Yii2 blog working with mongodb

image

devmustafa/yii2-blog-mongodb

Yii2 blog working with mongodb

  • Wednesday, December 7, 2016
  • by devmustafa
  • Repository
  • 1 Watchers
  • 2 Stars
  • 55 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Yii2 Blog MongoDB

It's a multi-language blog extension that uses Mongodb that gives you an awesome performance., (*1)

Check this tutorial that I like, in order to know more about Mongodb., (*2)

Installation

  • You have to have Mongodb up and running, so download it from here.
  • Also you have to have Mongodb PHP driver installed.

And you run Mongodb through the following command:, (*3)

mongod --fork --logpath /var/log/mongodb/mongodb.log
  • And you setup the extension through the composer:, (*4)

    composer require devmustafa/yii2-blog-mongodb, (*5)

Or add the following line in your composer.json:, (*6)

"devmustafa/yii2-blog-mongodb": "*"

Configuration

  1. In your common config file add the following db component:, (*7)

    ...
    'components' => [
        ...
        'mongodb' => [
            'class' => '\yii\mongodb\Connection',
            'dsn' => 'mongodb://127.0.0.1/DB_MONGO_NAME', // local
            // 'dsn' => 'mongodb://DB_MONGO_USERNAME:DB_MONGO_PASSWORD@DB_MONGO_HOST/DB_MONGO_NAME, // remote
        ],
        ...
    ],
    ...
  2. In your frontend config file add the following module:, (*8)

    ...
    'modules' => [
        ...
        'blog' => [
            'id' => 'blog',
            'class' => devmustafa\blog\modules\frontend\Module::className(),
            'used_languages' => ['en', 'ar'], // list of languages used
            'default_language' => 'en', // default language
            'listing_size' => 10, // default size of listing page
            'rules' => [ // setup rules for frontend routes
                // change key not value
                'posts' => '/post',
                'post/<slug>' => '/post/single',
                'category/<slug>' => '/post/category', // posts related to a specific category
            ]
        ],
        ...
    ]
    ...
  3. In your backend config file add the following module:, (*9)

    ...
    'modules' => [
        ...
        'blog' => [
            'id' => 'blog',
            'class' => devmustafa\blog\modules\backend\Module::className(),
            'upload_url' => 'http://example.com/uploads', // full upload url
            'upload_directory' => '/full/path/to/uploads/dir', // full upload directory
            'used_languages' => ['en', 'ar'], // list of languages used
            'default_language' => 'en', // default language
        ],
        ...
    ]
    ...
Note:

default_language must be one of your used_languages array, and if you would like to use a dynamic language in your app, so leave it empty:, (*10)

'default_language' => '', // empty (don't remove)

In this case the extension reading the value of Yii::$app->langauge and it should be one of your defined used_languages array., (*11)

Usage

  1. Go to your backend url to add some posts/authors/categories:, (*12)

    • /blog/post
    • /blog/author
    • /blog/category
  2. Then you check it out on your frontend:, (*13)

    • /posts

The Versions

07/12 2016

dev-master

9999999-dev

Yii2 blog working with mongodb

  Sources   Download

GPL-3.0+

The Requires

 

by Mustafa Magdi

mongodb extension yii2 blog

07/12 2016

1.0.4

1.0.4.0

Yii2 blog working with mongodb

  Sources   Download

GPL-3.0+

The Requires

 

by Mustafa Magdi

mongodb extension yii2 blog

04/12 2016

1.0.3

1.0.3.0

Yii2 blog working with mongodb

  Sources   Download

GPL-3.0+

The Requires

 

by Mustafa Magdi

mongodb extension yii2 blog

29/11 2016

1.0.2

1.0.2.0

Yii2 blog working with mongodb

  Sources   Download

GPL-3.0+

The Requires

 

by Mustafa Magdi

mongodb extension yii2 blog

20/09 2016

1.0.1

1.0.1.0

Yii2 blog working with mongodb

  Sources   Download

GPL-3.0+

The Requires

 

by Mustafa Magdi

mongodb extension yii2 blog

22/08 2016

1.0.0

1.0.0.0

Yii2 blog working with mongodb

  Sources   Download

GPL-3.0+

The Requires

 

by Mustafa Magdi

mongodb extension yii2 blog