PHP code example of cyneek / yii2-comments
1. Go to this page and download the library: Download cyneek/yii2-comments 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/ */
cyneek / yii2-comments example snippets
php yii migrate --migrationPath=@vendor/cyneek/yii2-comments/migrations
'modules' => [
'comment' => [
'class' => 'cyneek\comments\Module',
'userIdentityClass' => 'user\Identity'
],
...
]
'modules' => [
'comment' => [
'class' => 'cyneek\comments\Module',
'userIdentityClass' => 'user\Identity',
'controllerMap' => [
'comments' => 'cyneek\comments\controllers\ManageController'
]
],
...
]
echo \cyneek\comments\widgets\Comment::widget(['model' => $model]);
echo \cyneek\comments\widgets\Comment::widget(['entity' => '483f0e5a', 'entityId' => 149]);
[
'js' => ['file1'],
'css' => ['file2'],
'sourcePath' => 'url',
'depends' => ['file3', 'file4']
]
// ...
'modules' => [
// ...
'comment' => [
'class' => 'cyneek\comments\Module',
'modelMap' => [
'Comment' => '@app\comments\CommentModel'
]
]
],
// ...
// ...
'modules' => [
// ...
'comments' => [
'class' => 'cyneek\comments\Module',
'userIdentityClass' => 'app\models\User',
'modelMap' => [
'Comment' => [
'class' => '@app\comments\CommentModel',
'on event' => function(){
// code here
},
'as behavior' =>
['class' => 'Foo'],
]
]
],
// ...
// app/config/web.php
'components' => [
'view' => [
'theme' => [
'pathMap' => [
'@vendor/cyneek/comments/widgets/views' => '@app/views/comments', // example: @app/views/comment/_form.php
],
],
],
],
php composer.phar