{"id":15963795,"url":"https://github.com/skeeks-cms/cms-comments","last_synced_at":"2026-04-26T12:32:18.057Z","repository":{"id":57052426,"uuid":"61889826","full_name":"skeeks-cms/cms-comments","owner":"skeeks-cms","description":"Comments for skeeks cms","archived":false,"fork":false,"pushed_at":"2025-05-29T07:23:54.000Z","size":130,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-09T06:50:52.636Z","etag":null,"topics":["comments","skeeks","skeeks-cms","skeekscms","yii","yii2","yii2-extension"],"latest_commit_sha":null,"homepage":"https://skeeks.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skeeks-cms.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-24T14:24:38.000Z","updated_at":"2025-05-29T07:23:41.000Z","dependencies_parsed_at":"2022-08-24T04:11:33.075Z","dependency_job_id":null,"html_url":"https://github.com/skeeks-cms/cms-comments","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/skeeks-cms/cms-comments","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skeeks-cms%2Fcms-comments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skeeks-cms%2Fcms-comments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skeeks-cms%2Fcms-comments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skeeks-cms%2Fcms-comments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skeeks-cms","download_url":"https://codeload.github.com/skeeks-cms/cms-comments/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skeeks-cms%2Fcms-comments/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32297893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T09:34:17.070Z","status":"ssl_error","status_checked_at":"2026-04-26T09:34:00.993Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["comments","skeeks","skeeks-cms","skeekscms","yii","yii2","yii2-extension"],"created_at":"2024-10-07T17:00:28.896Z","updated_at":"2026-04-26T12:32:18.028Z","avatar_url":"https://github.com/skeeks-cms.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Comments\n===================================\n\nInstallation\n------------\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\nphp composer.phar require --prefer-dist skeeks/cms-comments \"*\"\n```\n\nor add\n\n```\n\"skeeks/cms-comments\": \"*\"\n```\n\n- Run migrations\n\n```php\nyii migrate --migrationPath=@skeeks/cms/comments/migrations/\n```\n\nHow to use (simple)\n----------\n\n\nConfiguration\n------\n\n- In your config file\n\n```php\n'bootstrap' =\u003e ['comments'],\n'components' =\u003e\n[\n'i18n' =\u003e [\n    'translations'  =\u003e\n    [\n        'skeeks/comments' =\u003e\n        [\n            'class'             =\u003e 'yii\\i18n\\PhpMessageSource',\n            'basePath'          =\u003e '@skeeks/cms/comments/messages',\n            'fileMap' =\u003e [\n                'skeeks/comments' =\u003e 'main.php',\n            ],\n        ]\n    ],\n],\n],\n\n'modules' =\u003e\n[\n\t'comments' =\u003e\n\t[\n\t    'class' =\u003e 'skeeks\\cms\\comments\\CommentsModule',\n\t    //'maxNestedLevel'          =\u003e 5\n        //'onlyRegistered'          =\u003e false\n        //'orderDirection'          =\u003e SORT_DESC\n        //'nestedOrderDirection'    =\u003e SORT_ASC\n        //'displayAvatar'           =\u003e true\n        //'commentsPerPage'         =\u003e 5,\n        'on commentAdded' =\u003e function(\\skeeks\\cms\\comments\\events\\CommentEvent $e)\n        {\n            /**\n             * @var $comment \\skeeks\\cms\\comments\\models\\CmsComment\n             */\n            $comment = $e-\u003ecomment;\n            $comment-\u003euser;\n            $comment-\u003emodel;\n            $comment-\u003emodel_id;\n        },\n\n        'on commentDeleted' =\u003e function(\\skeeks\\cms\\comments\\events\\CommentEvent $e)\n        {\n            //...\n        }\n\t]\n]\n```\n\n- In you model [optional]\n\n```php\npublic function behaviors()\n{\n  return [\n    'comments' =\u003e [\n      'class' =\u003e 'skeeks\\cms\\comments\\behaviors\\CommentsBehavior'\n    ]\n  ];\n}\n```\n\n- Content element property update count comments\n\n```php\n'on commentAdded' =\u003e function(\\skeeks\\cms\\comments\\events\\CommentEvent $e)\n{\n\t/**\n\t * @var $comment \\skeeks\\cms\\comments\\models\\CmsComment\n\t * @var $user \\common\\models\\User\n\t * @var $element \\skeeks\\cms\\models\\CmsContentElement\n\t */\n\t$comment = $e-\u003ecomment;\n\t$user = $comment-\u003euser;\n\n\t/*$user-\u003eappUser-\u003etotal_comments = $user-\u003eappUser-\u003etotal_comments + 1;\n\tif (!$user-\u003eappUser-\u003esave())\n\t{\n\t    \\Yii::error(\"Not update user total comments: {$user-\u003eid}\", 'project');\n\t}*/\n\n\t\\Yii::error(\\skeeks\\cms\\models\\CmsContentElement::tableName(), 'project');\n\t\\Yii::error(\\yii\\helpers\\Json::encode($comment-\u003etoArray()), 'project');\n\n\tif ($comment-\u003emodel == \\skeeks\\cms\\models\\CmsContentElement::tableName())\n\t{\n\t    $element = \\skeeks\\cms\\models\\CmsContentElement::findOne($comment-\u003emodel_id);\n\t    if ($element \u0026\u0026 $element-\u003erelatedPropertiesModel-\u003ehasAttribute('comments'))\n\t    {\n\t\t$totalComments = \\skeeks\\cms\\comments\\models\\CmsComment::find()-\u003ewhere([\n\t\t    'model_id' =\u003e $element-\u003eid,\n\t\t])-\u003eandWhere(['model' =\u003e \\skeeks\\cms\\models\\CmsContentElement::tableName()])-\u003ecount();\n\t\t$element-\u003erelatedPropertiesModel-\u003esetAttribute('comments', $totalComments);\n\t\t//$element-\u003erelatedPropertiesModel-\u003esetAttribute('comments', ((int) $element-\u003erelatedPropertiesModel-\u003egetAttribute('comments') + 1));\n\n\t\tif (!$element-\u003erelatedPropertiesModel-\u003esave())\n\t\t{\n\t\t    \\Yii::error(\"Not update element total comments: {$element-\u003eid}\", 'project');\n\t\t}\n\t    } else\n\t    {\n\t\t\\Yii::error(\"Element not found or not have property comments: {$element-\u003eid}\", 'project');\n\t    }\n\t}\n},\n\n'on commentDeleted' =\u003e function(\\skeeks\\cms\\comments\\events\\CommentEvent $e)\n{\n....\n\t    \n```\n\t    \nUsage\n---\n\n- Widget namespace\n```php\nuse skeeks\\cms\\comments\\widgets\\CommentsWidget;\n```\n\n- Add comment widget in model view using (string) page key :\n\n```php\necho Comments::widget(['model' =\u003e $pageKey]);\n```\n\n- Or display comments using model name and id:\n\n```php\necho Comments::widget(['model' =\u003e 'post', 'model_id' =\u003e 1]);\n```\n\n- Or display comments using model behavior:\n\n```php\necho Post::findOne(10)-\u003edisplayComments();\n```\n\nModule Options\n-------\n\nUse this options to configurate comments module:\n\n- `userModel` - User model class name.\n\n- `maxNestedLevel` - Maximum allowed nested level for comment's replies.\n\n- `onlyRegistered` - Indicates whether not registered users can leave a comment.\n\n- `orderDirection` - Comments order direction.\n\n- `nestedOrderDirection` - Replies order direction.\n\n- `userAvatar` - The field for displaying user avatars.\n\n  Is this field is NULL default avatar image will be displayed. Also it can specify path to image or use callable type.\n\n  If this property is specified as a callback, it should have the following signature: `function ($user_id)`\n\n\nFor dev\n-------\n```php\nphp yii lang/translate-app @skeeks/cms/comments/messages/ru/main.php @skeeks/cms/comments/messages/ main.php\n```\n___\n\n\n\u003e [![skeeks!](https://gravatar.com/userimage/74431132/13d04d83218593564422770b616e5622.jpg)](http://skeeks.com)  \n\u003ci\u003eSkeekS CMS (Yii2) — fast, simple, effective!\u003c/i\u003e  \n[skeeks.com](http://skeeks.com) | [cms.skeeks.com](http://cms.skeeks.com) | [marketplace.cms.skeeks.com](http://marketplace.cms.skeeks.com)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskeeks-cms%2Fcms-comments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskeeks-cms%2Fcms-comments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskeeks-cms%2Fcms-comments/lists"}