{"id":38534638,"url":"https://github.com/CakeDC/favorites","last_synced_at":"2026-01-25T02:01:12.860Z","repository":{"id":1037146,"uuid":"866061","full_name":"CakeDC/favorites","owner":"CakeDC","description":"Favorites Plugin for CakePHP","archived":false,"fork":false,"pushed_at":"2016-12-23T16:21:46.000Z","size":95,"stargazers_count":54,"open_issues_count":2,"forks_count":17,"subscribers_count":18,"default_branch":"master","last_synced_at":"2023-08-24T04:12:12.435Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://cakedc.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CakeDC.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-08-27T11:16:04.000Z","updated_at":"2023-08-24T04:12:12.435Z","dependencies_parsed_at":"2022-08-16T11:50:43.169Z","dependency_job_id":null,"html_url":"https://github.com/CakeDC/favorites","commit_stats":null,"previous_names":[],"tags_count":4,"template":null,"template_full_name":null,"purl":"pkg:github/CakeDC/favorites","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CakeDC%2Ffavorites","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CakeDC%2Ffavorites/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CakeDC%2Ffavorites/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CakeDC%2Ffavorites/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CakeDC","download_url":"https://codeload.github.com/CakeDC/favorites/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CakeDC%2Ffavorites/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28741625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T01:40:51.112Z","status":"online","status_checked_at":"2026-01-25T02:00:06.841Z","response_time":113,"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":[],"created_at":"2026-01-17T07:00:28.917Z","updated_at":"2026-01-25T02:01:12.853Z","avatar_url":"https://github.com/CakeDC.png","language":"PHP","funding_links":[],"categories":["Social"],"sub_categories":[],"readme":"# Favorites Plugin for CakePHP #\r\n\r\nVersion 1.1 for cake 2.x\r\n\r\nFavorites plugin allows to associate users to any record in your database through human readable tags or categories.\r\n\r\n## Installation ##\r\n\r\n1. Place the favorites folder into any of your plugin directories for your app (for example `app/Plugin` or `root_dir/plugins`)\r\n2. Create the required database tables using either the schema shell or the migrations plugin:\r\n\r\n\t\tcake schema create --plugin Favorites --name favorites\r\n\t\tcake Migrations.migration run all --plugin Favorites\r\n\r\n3. This plugin requires that you setup some parameters in global Configure storage:\r\n 1. `Favorites.types contains supported objects that allowed to be stored as favorites.\r\n 2. `Favorites.modelCategories allow to list all models and required contains for it.\r\n 3. `Favorites.defaultTexts sets the default text for the helper toggleFavorite method\r\n\r\nExample:\r\n\r\n\tConfigure::write('Favorites.types', array('post' =\u003e 'Blogs.Post', 'link' =\u003e 'Link'));\r\n\tConfigure::write('Favorites.defaultTexts', array('favorite' =\u003e __('Favorite it'), 'watch' =\u003e __('Watch it')));\r\n\tConfigure::write('Favorites.modelCategories', array('Post', 'Link'));\r\n\r\nOr you could use the Configure::load() method to load a configuration file that has content similar to that below:\r\n\r\n\t$config['Favorites'] = array(\r\n\t\t'types' =\u003e array(\r\n\t\t\t'favorite' =\u003e 'Post',\r\n\t\t\t'watch' =\u003e 'Post'\r\n\t\t),\r\n\t\t'defaultTexts' =\u003e array(\r\n\t\t\t'favorite' =\u003e __('Favorite it'),\r\n\t\t\t'watch' =\u003e __('Watch it')\r\n\t\t),\r\n\t\t'modelCategories' =\u003e array(\r\n\t\t\t'Post'\r\n\t\t)\r\n\t);\r\n\r\n## Usage ##\r\n\r\nAdd the Favorites helper to your controller:\r\n\r\n\tpublic $helpers = array('Favorites.Favorites');\r\n\r\nAttach the Favorite behavior to your models via the `$actsAs` variable or dynamically using the `BehaviorsCollection` object methods:\r\n\r\n\tpublic $actsAs = array('Favorites.Favorite');\r\n\t// Or\r\n\t$this-\u003eBehaviors-\u003eattach('Favorites.Favorite');\r\n\r\nUse the favourites helper in your views to generate links to mark a model record as favorite:\r\n\r\n\t\u003c?php echo $this-\u003eFavorites-\u003etoggleFavorite('favorite-type', $modelId); ?\u003e\r\n\r\nThis link will toggle the \"favorite-type\" tag for this user and model record.\r\n\r\nIf you want the helper to distinguish whether it needs to activate or deactivate the favorite flag in for the user, you need to pass to the view the variable `userFavorites` containing an associative array of user favorites per favorite type. The following structure is needed:\r\n\r\n\tarray(\r\n\t\t'favorite-type1' =\u003e array(\r\n\t\t\t'favorite-id1' =\u003e 'model-foreignKey-1',\r\n\t\t\t'favorite-id2' =\u003e 'model-foreignKey-3'\r\n\t\t\t'favorite-id3' =\u003e 'model-foreignKey-2'\r\n\t\t),\r\n\t\t'favorite-type2' =\u003e array(\r\n\t\t\t'favorite-id4' =\u003e 'model-foreignKey-1',\r\n\t\t\t'favorite-id5' =\u003e 'model-foreignKey-3'\r\n\t\t\t'favorite-id6' =\u003e 'model-foreignKey-2'\r\n\t\t)\r\n\t);\r\n\r\nYou can achieve this result using with method `getAllFavorites` in `Favorite` model:\r\n\r\n\t$Favorite = ClassRegistry::init('Favorites.favorite');\r\n\t$this-\u003eset('userFavorites', $Favorite-\u003egetAllFavorites('user-id'));\r\n\r\n## Configuration Options ##\r\n\r\nThe Favorite behavior has some configuration options to adapt to your apps needs.\r\n\r\nThe configuration array accepts the following keys:\r\n\r\n* `favoriteAlias` - The name of the association to be created with the model the Behavior is attached to and the favoriteClass model. Default: Favorite\r\n* `favoriteClass` - If you need to extend the Favorite model or override it with your own implementation set this key to the model you want to use\r\n* `foreignKey` - the field in your table that serves as reference for the primary key of the model it is attached to. (Used for own implementations of Favorite model)\r\n* `counter_cache` - the name of the field that will hold the number of times the model record has been favorited\r\n\r\n## Callbacks ##\r\n\r\nAdditionally the behavior provides two callbacks to implement in your model:\r\n\r\n* `beforeSaveFavorite` - called before save favorite. Should return boolean value.\r\n* `afterSaveFavorite` - called after save favorite.\r\n\r\n## Requirements ##\r\n\r\n* PHP version: PHP 5.2+\r\n* CakePHP version: 2.x Stable\r\n\r\n## Requirements ##\r\n\r\n* PHP version: PHP 5.2+\r\n* CakePHP version: Cakephp 2.x Stable\r\n\r\n## Support ##\r\n\r\nFor support and feature request, please visit the [Favorites Plugin Support Site](http://cakedc.lighthouseapp.com/projects/59901-favourites-plugin/).\r\n\r\nFor more information about our Professional CakePHP Services please visit the [Cake Development Corporation website](http://cakedc.com).\r\n\r\n## Branch strategy ##\r\n\r\nThe master branch holds the STABLE latest version of the plugin. \r\nDevelop branch is UNSTABLE and used to test new features before releasing them. \r\n\r\nPrevious maintenance versions are named after the CakePHP compatible version, for example, branch 1.3 is the maintenance version compatible with CakePHP 1.3.\r\nAll versions are updated with security patches.\r\n\r\n## Contributing to this Plugin ##\r\n\r\nPlease feel free to contribute to the plugin with new issues, requests, unit tests and code fixes or new features. If you want to contribute some code, create a feature branch from develop, and send us your pull request. Unit tests for new features and issues detected are mandatory to keep quality high. \r\n\r\n\r\n## License ##\r\n\r\nCopyright 2009-2012, [Cake Development Corporation](http://cakedc.com)\r\n\r\nLicensed under [The MIT License](http://www.opensource.org/licenses/mit-license.php)\u003cbr/\u003e\r\nRedistributions of files must retain the above copyright notice.\r\n\r\n## Copyright ###\r\n\r\nCopyright 2009-2012\u003cbr/\u003e\r\n[Cake Development Corporation](http://cakedc.com)\u003cbr/\u003e\r\n1785 E. Sahara Avenue, Suite 490-423\u003cbr/\u003e\r\nLas Vegas, Nevada 89104\u003cbr/\u003e\r\nhttp://cakedc.com\u003cbr/\u003e\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCakeDC%2Ffavorites","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCakeDC%2Ffavorites","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCakeDC%2Ffavorites/lists"}