PHPackages                             elephantsgroup/eg-follow - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. elephantsgroup/eg-follow

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

elephantsgroup/eg-follow
========================

yii2 follow module

1.0.1(7y ago)034[1 issues](https://github.com/ElephantsGroup/eg-follow/issues)4MITPHP

Since May 20Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ElephantsGroup/eg-follow)[ Packagist](https://packagist.org/packages/elephantsgroup/eg-follow)[ RSS](/packages/elephantsgroup-eg-follow/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (4)

To use Elephants Group follow module first you must install module, then you can use follow widget anywhere in your website.

Installation Steps:
===================

[](#installation-steps)

1. run

> php composer.phar require elephantsgroup/eg-follow "\*"

or add `"elephantsgroup/eg-follow": "*"` to the require section of your composer.json file.

2. migrate database

> yii migrate --migrationPath=vendor/elephantsgroup/eg-follow/migrations

3. add follow module to common configuration (common/config.php file)

```
    ...
    'follow' => [
        'class' => 'elephantsGroup\follow\Module',
    ],
    ...
]```

4) open access to module in common configuration

```'as access' => [
    'class' => 'mdm\admin\components\AccessControl',
    'allowActions' => [
        ...
        'follow/ajax/*',
        ...
    ]
]```

5) filter admin controller in frontend configuration (frontend/config.php file)

```'modules' => [
    ...
    'follow' => [
        'as frontend' => 'elephantsGroup\follow\filters\FrontendFilter',
    ],
    ...
]```

5) filter ajax controller in backend configuration (backend/config.php file)

```'modules' => [
    ...
    'follow' => [
        'as backend' => 'elephantsGroup\follow\filters\BackendFilter',
    ],
    ...
]```

Using follow widget
===

Anywhere in your code you can use follow widget as follows:
``````

You need to use Follows widget header in your page:
```use elephantsGroup\follow\components\Follows;```

Follow widget parameters
---

- item (integer): to separate follows between different items.
``````
``````

default value for item is 0
- service (integer): to separate follows between various item types.
``````

for example you can use different values for different modules in your app, and then use follow widget separately in modules.
default value for service is 0
- color (string): color of unfollowed icon heart, default 'black'
```
