Download the PHP package aka03/yii2-comments without Composer
On this page you can find all versions of the php package aka03/yii2-comments. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-comments
Yii2 Comments
Yii2 Simple Comments Widget
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json
file.
Migration
Usage
Once the extension is installed, simply use it in your code by :
If you want to use this widget in module, change page
attribute into:
Attributes
page
using for indicate current controller for showing comments.
page_id
using for indicate current id. If this attribute is set each page
will have own comments.
For example if current route = 'site/about', you can add following code:
For simple page
you can set page_id
= null, or do not even set.
guestCanLeaveComment
(boolean, default = true). If user is not logged in, he can't leave comments.
showCommentsForGuests
(boolean, default = true). Show comments for guest users ().
showRelativeTime
(boolean, default = true). Show time as relative. False means datetime will be shown.
avatarField
(string, default = 'avatar'). User avatar field in database.
If this field not found, default avatar will be used.
Full code should looks like:
Tests
For coverage add following lines into indet-test.php file, before Application->run().
Change c3_url
to frontend/index-test.php, in codeception.yml file. (For example http://localhost/index-test.php
).
For acceptance tests:
- do not forget install selenium-server;
- change
url
in tests/acceptance.suite.yml file; - add following lines to test config file: