{"id":14966531,"url":"https://github.com/bubasuma/yii2-simplechat","last_synced_at":"2026-03-07T09:31:32.005Z","repository":{"id":62497870,"uuid":"46654886","full_name":"bubasuma/yii2-simplechat","owner":"bubasuma","description":"A simple chat for your yii2 application","archived":false,"fork":false,"pushed_at":"2019-11-22T22:21:41.000Z","size":2653,"stargazers_count":88,"open_issues_count":14,"forks_count":38,"subscribers_count":16,"default_branch":"master","last_synced_at":"2026-03-05T20:05:19.497Z","etag":null,"topics":["javascript","php","twig","yii","yii2"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bubasuma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-22T09:59:59.000Z","updated_at":"2025-10-03T20:00:14.000Z","dependencies_parsed_at":"2022-11-02T12:15:46.822Z","dependency_job_id":null,"html_url":"https://github.com/bubasuma/yii2-simplechat","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/bubasuma/yii2-simplechat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubasuma%2Fyii2-simplechat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubasuma%2Fyii2-simplechat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubasuma%2Fyii2-simplechat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubasuma%2Fyii2-simplechat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bubasuma","download_url":"https://codeload.github.com/bubasuma/yii2-simplechat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubasuma%2Fyii2-simplechat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30150108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T21:15:50.531Z","status":"ssl_error","status_checked_at":"2026-03-05T21:15:11.173Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["javascript","php","twig","yii","yii2"],"created_at":"2024-09-24T13:36:32.856Z","updated_at":"2026-03-07T09:31:31.978Z","avatar_url":"https://github.com/bubasuma.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"#Yii2 Simple Chat\nA simple chat for your yii2 application\n\n##Installation\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 bubasuma/yii2-simplechat\n```\n\nor add\n\n```\n\"bubasuma/yii2-simplechat\": \"*\"\n```\n\nto the require section of your `composer.json` file.\n\n##Demo\n\nOnce the extension is installed, simply modify your application configuration as follows:\n\n```php\nreturn [\n    'bootstrap' =\u003e ['simplechat'],\n    'modules' =\u003e [\n        'simplechat' =\u003e [\n            'class' =\u003e 'bubasuma\\simplechat\\Module',\n        ],\n        // ...\n    ],\n    // ...\n];\n```\nUse the same configuration for your console application:\n\n\u003eNote: You need this configuration to access simple chat via command line. You can remove it in production mode.\n\nYou can access Simple Chat via command line as follows:\n\n```\n# change path to your application's base path\ncd path/to/AppBasePath\n\n# show available commands\nphp yii simplechat\n\n# create test tables, generates and load fixtures\nphp yii simplechat/start\n\n# unload fixtures\nphp yii simplechat/clean\n\n# unload fixtures and load them again\nphp yii simplechat/reset\n\n# unload fixtures and drop test tables\nphp yii simplechat/stop\n```\n\nYou can specify different options of the `start` and `reset` command:\n\n```\n# You can specify how many fixtures per user and message you need by the --users and --messages options\nphp yii simplechat/start --users=50 --messages=10000\nphp yii simplechat/reset --users=20 --messages=5000\n\n# You can specify in what language to generate fixtures by the --language option. Thanks to yii2-faker\nphp yii simplechat/start --language=\"ru_RU\"\nphp yii simplechat/reset --language=\"fr_FR\"\n\n```\n\nYou can then access Simple Chat through the following URL:\n\n```\nhttp://localhost/path/to/index.php?r=messages\n```\n\nor if you have enabled pretty URLs, you may use the following URL:\n\n```\nhttp://localhost/path/to/index.php/messages\n```\n\nYou should see the below:\n\n![yii simple chat demo page](http://i.imgur.com/1YZdjN8.png \"yii simple chat demo page\")\n\nIf not, please check if demo migration has been successfully applied against your database. You can check it by running the following command:\n\n```\nphp yii simplechat/start\n```\n\u003eNote: the command above is accessible only if you have configured your console application as it is recommended above.\n\n##Usage\n\nExtend the main `conversation` class like follow:\n\n```php\nnamespace common\\models;\n\nuse common\\models\\User;\n//...\n\nclass Conversation extends \\bubasuma\\simplechat\\db\\Conversation\n{\n    public function getContact()\n    {\n        return $this-\u003ehasOne(User::className(), ['id' =\u003e 'contact_id']);\n    }\n    \n    /**\n     * @inheritDoc\n     */\n    protected static function baseQuery($userId)\n    {\n        return parent::baseQuery($userId) -\u003ewith(['contact.profile']);\n    }\n    \n    /**\n     * @inheritDoc\n     */\n    public function fields()\n    {\n        return [\n            //...\n            'contact' =\u003e function ($model) {\n                return $model['contact'];\n            },\n            'deleteUrl',\n            'readUrl',\n            'unreadUrl',\n            //...\n        ];\n    }\n}\n```\n\nExtend the main `message` class like follow:\n\n```php\nnamespace common\\models;\n\n//...\n\nclass Message extends \\bubasuma\\simplechat\\db\\Message\n{\n    /**\n     * @inheritDoc\n     */\n    public function fields()\n    {\n        return [\n            //...\n            'text',\n            'date' =\u003e 'created_at',\n            //...\n        ];\n    }\n}\n```\n\nCreate a controller like follow:\n\n```php\nnamespace frontend\\controllers;\n\n//...\nuse yii\\web\\Controller;\nuse common\\models\\Conversation;\nuse common\\models\\Message;\nuse bubasuma\\simplechat\\controllers\\ControllerTrait;\n//...\n\nclass MessageController extends Controller\n{\n    use ControllerTrait;\n    \n    /**\n     * @return string\n     */\n    public function getMessageClass()\n    {\n        return Message::className();\n    }\n\n    /**\n     * @return string\n     */\n    public function getConversationClass()\n    {\n        return Conversation::className();\n    }\n}\n```\n\u003eNote: If you are using this extension in your frontend application, you can find the usage of widgets  in `index.twig`.\n\n##FAQ\n**Does this extension work with any template engines other than `twig`?**\n\nYes. Given that, the default render in `yii2` is `php`, you must indicate explicitly the extension part in view names.\n\n**Can I use this extension in a RESTful APIs?**\n\nYes, You can. \n\n**Can I use different template engines for rendering in server side and client side?**\n\nYes. But using the same template in both sides remains the best implementation.\n\n##Wiki\n[Using twig as template engine](https://github.com/bubasuma/yii2-simplechat/wiki/Using-twig-as-template-engine)\n\n[Pusher integration](https://github.com/bubasuma/yii2-simplechat/wiki/Pusher-integration)\n\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbubasuma%2Fyii2-simplechat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbubasuma%2Fyii2-simplechat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbubasuma%2Fyii2-simplechat/lists"}