Download the PHP package kareylo/cakephp-comments without Composer
On this page you can find all versions of the php package kareylo/cakephp-comments. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kareylo/cakephp-comments
More information about kareylo/cakephp-comments
Files in kareylo/cakephp-comments
Package cakephp-comments
Short Description A fully customizable Comments plugin for CakePHP 3.
License MIT
Homepage https://github.com/Kareylo/CakePHP-Comments
Informations about the package cakephp-comments
Fully customizable Comments Plugin for CakePHP 3
The Comments plugin will allow you comment every model with the possibility to change the template in your APP.
This plugin works with a behavior and a helper you need to load to fully works.
Requirements
- CakePHP 3.4+
- PHP 5.6+
- AuthComponent
Installation
load the plugin in your config/bootstrap.php
:
Add in the ModelTable you wanna be commentable the following behavior :
The behavior can take these options :
- modelClass : Class name of the ModelTable.
- Default :
null
- Default :
- commentClass : Name of your CommentsTable if you have one.
- Default :
Kareylo/Comments.Comments
- Default :
- foreignKey : Name of your custom foreignKey.
- Default :
ref_id
- Default :
- countComments : Put true if you wanna your model count its Comments
- Default :
false
- Default :
- fieldCounter : Name of your counter field
- Default :
comments_count
- Default :
Add the following helper in your src/View/AppView.php
The helper can take these options :
- type The HTML tag that will surround your comments
- Default
ul
- Accept
ul
,ol
,div
- Default
- typeClass the CSS class your type need to have
- Default
null
- Default
- subTypeClass The CSS class your subType need to have
- Default
null
- Default
- loadJS Put true if you wanna default JS to be loaded
- Default
false
- Default
Usage
Get all your comments with the comments finder
To display your comments
You can also chose to not use display($data)
and use a loop to have the full control of your template
Templates
To create templates for the comment block (1 comment) and the form block, create the views you want if src/Template/Element/Comments
.
Example :
To create the template for your flash, just add a element in src/Template/Element/Flash/Comments
and name it comment.ctp
$params['class']
can have the valuessuccess
anderror
Support
For bugs and feature requests, please use the issues section of this repository.
Contribute
Follow this guide to contribute
License
Licensed under the MIT License. Redistributions of the source code included in this repository must retain the copyright notice found in each file.
TODO
- [X] Test cases
- [ ] Improved Test Cases (like test Helper)
- [ ] More features
- [ ] Translation
All versions of cakephp-comments with dependencies
cakephp/cakephp Version >=3.4 <4.0.0
cakephp/migrations Version @stable