{"id":19210691,"url":"https://github.com/mhndev/rate","last_synced_at":"2025-07-31T01:12:25.401Z","repository":{"id":62527801,"uuid":"57944722","full_name":"mhndev/rate","owner":"mhndev","description":"Multi Purpose Rate System (Supports like, dislike, rate with other numbers or text)","archived":false,"fork":false,"pushed_at":"2017-10-09T10:30:10.000Z","size":31,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-05-12T19:29:15.247Z","etag":null,"topics":["rate","rating-system"],"latest_commit_sha":null,"homepage":null,"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/mhndev.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":"2016-05-03T05:53:30.000Z","updated_at":"2023-08-27T18:34:44.000Z","dependencies_parsed_at":"2022-11-02T14:16:43.344Z","dependency_job_id":null,"html_url":"https://github.com/mhndev/rate","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/mhndev/rate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhndev%2Frate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhndev%2Frate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhndev%2Frate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhndev%2Frate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhndev","download_url":"https://codeload.github.com/mhndev/rate/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhndev%2Frate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267972522,"owners_count":24174376,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["rate","rating-system"],"created_at":"2024-11-09T13:36:54.312Z","updated_at":"2025-07-31T01:12:25.367Z","avatar_url":"https://github.com/mhndev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rate System\n\n## Supports\n\n### 1) Like\n### 2) Like (+1), Dislike(-1)\n### 3) Rate with other number(e.x. 0 \u003c rate \u003c= 5 )\n### 4) Rate with string ('good' , 'very good' , ...)\n\n## Sample Usage\n```php\n\nuse mhndev\\rate\\Abstracts\\Entity;\nuse mhndev\\rate\\DiscreteNumberValue;\nuse mhndev\\rate\\Interfaces\\iRateableEntity;\n\nclass User\n{\n    use \\mhndev\\rate\\Traits\\UserTrait;\n\n    /**\n     * @param $value\n     * @param iRateableEntity $entity\n     * @param $type\n     */\n    function doRate($value, iRateableEntity $entity, $type)\n    {\n        echo 'rate is done in our storage system.';\n    }\n}\n\n//you can either extend your entity from AbstractEntity class\nclass Post extends Entity\n{\n\n}\n//or use EntityTrait in your Entity\n\nclass Post implements iRateableEntity\n{\n    use \\mhndev\\rate\\Traits\\EntityTrait;\n}\n\n\nclass Comment extends Entity\n{\n\n}\n\n//or use EntityTrait in your Entity\nclass Comment implements iRateableEntity\n{\n    use \\mhndev\\rate\\Traits\\EntityTrait;\n}\n\n$rateValue = (new DiscreteNumberValue())-\u003esetPossibleValues([1,2,3]);\n$post = (new Post())-\u003esetRateValue($rateValue);\n//or\nPost::setRateValue($rateValue);\n\n$post-\u003esetPossibleRateTypes(['like', 'rate']);\n\n\n$rateValue = (new DiscreteNumberValue())-\u003esetPossibleValues([-1,1]);\n$comment = (new Comment())-\u003esetRateValue($rateValue);\n\n//or\nComment::setRateValue($rateValue);\n// by default possible rate types are \"rate\" and \"like\" so if you want your rate types to be just like default you don't need to call setPossibleRateTypes method on entity pbject\n\n$post-\u003esetPossibleRateTypes(['like', 'rate', 'test']);\n//or\nPost::setPossibleRateTypes(['like', 'rate', 'test']);\n\n\n$user = new User;\n\n$user-\u003erate(3, $post);\n$user-\u003elike($post);\n$user-\u003erate(1,$comment);\n$user-\u003edislike($comment);\n\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhndev%2Frate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhndev%2Frate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhndev%2Frate/lists"}