{"id":13411127,"url":"https://github.com/Chiliec/yii2-vote","last_synced_at":"2025-03-14T16:33:59.464Z","repository":{"id":25285573,"uuid":"28711425","full_name":"chiliec/yii2-vote","owner":"chiliec","description":"Provides voting for any model :+1: :-1:","archived":false,"fork":false,"pushed_at":"2018-06-10T08:34:03.000Z","size":173,"stargazers_count":72,"open_issues_count":5,"forks_count":29,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-10-30T01:58:38.424Z","etag":null,"topics":["php","rating","vote","voting","yii2","yii2-extension"],"latest_commit_sha":null,"homepage":"","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/chiliec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-02T11:24:58.000Z","updated_at":"2023-12-26T13:56:47.000Z","dependencies_parsed_at":"2022-08-24T00:20:50.506Z","dependency_job_id":null,"html_url":"https://github.com/chiliec/yii2-vote","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiliec%2Fyii2-vote","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiliec%2Fyii2-vote/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiliec%2Fyii2-vote/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiliec%2Fyii2-vote/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chiliec","download_url":"https://codeload.github.com/chiliec/yii2-vote/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243610842,"owners_count":20319036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["php","rating","vote","voting","yii2","yii2-extension"],"created_at":"2024-07-30T20:01:11.597Z","updated_at":"2025-03-14T16:33:59.113Z","avatar_url":"https://github.com/chiliec.png","language":"PHP","funding_links":[],"categories":["Module 模块","Modules"],"sub_categories":[],"readme":"# Vote for Yii2\n\n[![Latest Stable Version](https://poser.pugx.org/chiliec/yii2-vote/v/stable.svg)](https://packagist.org/packages/chiliec/yii2-vote) \n[![Total Downloads](https://poser.pugx.org/chiliec/yii2-vote/downloads.svg)](https://packagist.org/packages/chiliec/yii2-vote) \n[![Build Status](https://travis-ci.org/chiliec/yii2-vote.svg?branch=master)](https://travis-ci.org/chiliec/yii2-vote) \n[![Code Climate](https://codeclimate.com/github/chiliec/yii2-vote/badges/gpa.svg)](https://codeclimate.com/github/chiliec/yii2-vote) \n[![Test Coverage](https://codeclimate.com/github/chiliec/yii2-vote/badges/coverage.svg)](https://codeclimate.com/github/chiliec/yii2-vote/coverage) \n[![License](https://poser.pugx.org/chiliec/yii2-vote/license.svg)](https://packagist.org/packages/chiliec/yii2-vote)\n\n![How yii2-vote works](https://raw.githubusercontent.com/chiliec/yii2-vote/master/docs/showcase.gif)\n\n## Installation\n\nNext steps will guide you through the process of installing yii2-vote using **composer**. Installation is a quick and easy three-step process.\n\n### Step 1: Install component via composer\n\nRun command\n\n```\nphp composer.phar require --prefer-dist chiliec/yii2-vote \"^4.2\"\n```\n\nor add\n\n```\n\"chiliec/yii2-vote\": \"^4.2\"\n```\n\nto the require section of your `composer.json` file.\n\n\n### Step 2: Configuring your application\n\nAdd following lines to your main configuration file:\n\n```php\n'bootstrap' =\u003e [\n    'chiliec\\vote\\components\\VoteBootstrap',\n],\n'modules' =\u003e [\n    'vote' =\u003e [\n        'class' =\u003e 'chiliec\\vote\\Module',\n        // show messages in popover\n        'popOverEnabled' =\u003e true,\n        // global values for all models\n        // 'allowGuests' =\u003e true,\n        // 'allowChangeVote' =\u003e true,\n        'models' =\u003e [\n        \t// example declaration of models\n            // \\common\\models\\Post::className(),\n            // 'backend\\models\\Post',\n            // 2 =\u003e 'frontend\\models\\Story',\n            // 3 =\u003e [\n            //     'modelName' =\u003e \\backend\\models\\Mail::className(),\n            //     you can rewrite global values for specific model\n            //     'allowGuests' =\u003e false,\n            //     'allowChangeVote' =\u003e false,\n            // ],\n        ],      \n    ],\n],\n```\n\nAnd add widget in view:\n\n```php\n\u003c?php echo \\chiliec\\vote\\widgets\\Vote::widget([\n    'model' =\u003e $model,\n    // optional fields\n    // 'showAggregateRating' =\u003e true,\n]); ?\u003e\n```\n\nAlso you can add widget for display top rated models:\n\n```php\n\u003c?php echo \\chiliec\\vote\\widgets\\TopRated::widget([\n    'modelName' =\u003e \\common\\models\\Post::className(),\n    'title' =\u003e 'Top rated models',\n    'path' =\u003e 'site/view',\n    'limit' =\u003e 10,\n    'titleField' =\u003e 'title',\n]) ?\u003e\n```\n\n### Step 3: Updating database schema\n\nAfter you downloaded and configured Yii2-vote, the last thing you need to do is updating your database schema by applying the migrations:\n\n```bash\n$ php yii migrate/up --migrationPath=@vendor/chiliec/yii2-vote/migrations\n```\n\n## Documentation\n\nExtended information about configuration of this module see in [docs/README.md](https://github.com/chiliec/yii2-vote/blob/master/docs/README.md). There you can find:\n* [Migration from 2.* to 3.0](https://github.com/chiliec/yii2-vote/blob/master/docs/README.md#migration-from-2-to-30)\n* [Manually add behavior in models](https://github.com/chiliec/yii2-vote/blob/master/docs/README.md#manually-add-behavior-in-models)\n* [Sorting by rating in data provider](https://github.com/chiliec/yii2-vote/blob/master/docs/README.md#sorting-by-rating-in-data-provider)\n* [Overriding views](https://github.com/chiliec/yii2-vote/blob/master/docs/README.md#overriding-views)\n* [Customizing JS-events](https://github.com/chiliec/yii2-vote/blob/master/docs/README.md#customizing-js-events)\n* [Rich snippet in search engines](https://github.com/chiliec/yii2-vote/blob/master/docs/README.md#rich-snippet-in-search-engines)\n\n## List of contributors\n\n* [chiliec](https://github.com/chiliec) - Maintainer\n* [loveorigami](https://github.com/loveorigami) - Ideological inspirer\n* [fourclub](https://github.com/fourclub) - PK name fix in behavior\n* [yurkinx](https://github.com/yurkinx) - Duplication js render fix\n* [n1k88](https://github.com/n1k88) - German translation\n* [teranchristian](https://github.com/teranchristian) - Add popover to display messages\n* [Skatox](https://github.com/Skatox) - Add support for PostgreSQL\n\n## Other vote solutions for Yii2\n\n* [yii2-vote by hauntd](https://github.com/hauntd/yii2-vote) - it allows you to attach vote widgets, like and favorite buttons to your models\n* [yii2-vote by bigdropinc](https://github.com/bigdropinc/yii2-vote) - another solution with same name\n\n## Articles and tutorials\n\n* [Programming With Yii2: Building Community With Voting, Comments, and Sharing](https://code.tutsplus.com/tutorials/programming-with-yii-building-community-with-voting-comments-and-sharing--cms-27798) by Jeff Reifman\n\n## Usage examples\n\n* Your site could be the first in this list\n\n## License\n\nyii2-vote is released under the BSD 3-Clause License. See the bundled [LICENSE.md](https://github.com/chiliec/yii2-vote/blob/master/LICENSE.md) for details.\n\n## How to contribute \n\nSee [CONTRIBUTING.md](https://github.com/chiliec/yii2-vote/blob/master/CONTRIBUTING.md) for details.\n\nEnjoy and don't hesitate to send issues and pull requests :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChiliec%2Fyii2-vote","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FChiliec%2Fyii2-vote","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChiliec%2Fyii2-vote/lists"}