PHP code example of bossit / yii2-favourite

1. Go to this page and download the library: Download bossit/yii2-favourite library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bossit / yii2-favourite example snippets


'components' => [
    'favourite' => [
        'class'    => \bossit\logger\FavouriteService::class,
        'lifetime' => 31536000,
        'cookieName' => 'favourite'
    ],
],

// add to favourite
\Yii::$app->favourite->add($productId);

// remove from favourite
\Yii::$app->favourite->remove($productId);

// get items of favourite
\Yii::$app->favourite->getItems();