shieldfy/shieldfy-yii-extension

There is no license information available for the latest version (0.1.3) of this package.

This is the official PHP SDK for Shieldfy (shieldfy.io)

0.1.3 2018-09-11 16:55 UTC

This package is not auto-updated.

Last update: 2024-04-28 03:36:11 UTC


README

Require shieldfy Yii extension

From your console navigate to your application folder and enter the command below:

composer require shieldfy/shieldfy-yii-extension

for more information about composer click here

Add Shieldfy Component

'bootstrap' => ['shieldfy'],
'components' => [
    ...
    'shieldfy' => [
          'class' => 'Shieldfy\Extensions\Yii\BootstrapLoader',
          'appKey' => '<APP_KEY>',
          'appSecret' => '<APP_SECRET>',
    ],
    ...
]

Add Shieldfy DB listener

If you use Yii2 Basic. add shieldfy attachPDO to this file config/db.php

return [
    .....

    'on afterOpen' => function($event) {
            (\Yii::$container->get('shieldfy'))?\Yii::$container->get('shieldfy')->attachPDO($event->sender->pdo):null;
    }
]

If you use Yii2 Advanced. add shieldfy attachPDO to this file common/config/main-local.php

return [
    'components' => [
        'db' => [
            ...
            'on afterOpen' => function($event) {
                (\Yii::$container->get('shieldfy'))?\Yii::$container->get('shieldfy')->attachPDO($event->sender->pdo):null;
        	},
        ],
        'mailer' => [
        .....
    ],
];