{"id":18474193,"url":"https://github.com/usmanhalalit/getsetgo","last_synced_at":"2025-04-08T12:32:09.232Z","repository":{"id":57076128,"uuid":"10765846","full_name":"usmanhalalit/GetSetGo","owner":"usmanhalalit","description":"A dynamic setter-getter library for PHP","archived":false,"fork":false,"pushed_at":"2013-07-10T14:22:07.000Z","size":144,"stargazers_count":18,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-04T21:38:45.854Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/usmanhalalit.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2013-06-18T14:51:17.000Z","updated_at":"2021-03-08T19:55:21.000Z","dependencies_parsed_at":"2022-08-24T14:55:48.772Z","dependency_job_id":null,"html_url":"https://github.com/usmanhalalit/GetSetGo","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usmanhalalit%2FGetSetGo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usmanhalalit%2FGetSetGo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usmanhalalit%2FGetSetGo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usmanhalalit%2FGetSetGo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usmanhalalit","download_url":"https://codeload.github.com/usmanhalalit/GetSetGo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247842736,"owners_count":21005339,"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":[],"created_at":"2024-11-06T10:28:25.951Z","updated_at":"2025-04-08T12:32:08.806Z","avatar_url":"https://github.com/usmanhalalit.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GetSetGo [![Build Status](https://travis-ci.org/usmanhalalit/GetSetGo.png?branch=master)](https://travis-ci.org/usmanhalalit/GetSetGo)\nA dynamic setter-getter library for PHP 5.4+.\n\nYou can use methods like `setFoo('bar')` and `getFoo()`, which you DON'T have to create (in your class). GetSetGo will make these methods work for you automatically as long as you have a `$foo` property in your class. \n\nIt makes use of Traits, so `using` it is super simple, you don't have to extend any class, as you can extend a single class only, we don't force you to use ours.\nYou can restrict to only getter only or you can specify a Type for property using **annotations**.\n\n## Installation\n\nGetSetGo uses [Composer](http://getcomposer.org/) to make hassles Go.\n\nLearn to use composer and add this to require (in your composer.json):\n\n    \"usmanhalalit/get-set-go\": \"1.*@dev\"\n\nLibrary on [Packagist](https://packagist.org/packages/usmanhalalit/get-set-go).\n\n## Usage\n\nJust add this in your classes:\n\n    use \\GetSetGo\\SetterGetter;\n\nExample:\n```PHP\nClass MyClass{\n    use \\GetSetGo\\SetterGetter;\n\n    protected $foo;\n}\n```\nNow use it as\n```PHP\n$myClass = new MyClass;\n\n$myClass-\u003esetFoo('bar');\necho $myClass-\u003egetFoo();\n```\n\n\n**That's basically it.**\n\n### Restrict Getter or Setter or Both\n\nYou can use annotation in you class property if you want to disable setter, getter or both using `@setter` and `@getter` annotation variables.\n```PHP\n/**\n * We can't use setSomeProperty() anymore.\n *\n * @var\n * @setter false\n */\nprotected $someProperty;\n```\n___\n```PHP\n/**\n * We can't use getSomeProperty() anymore.\n *\n * @var \\stdClass\n * @getter false\n */\nprotected $someProperty;\n```\n___\n\n```PHP\n/**\n * We can't use setSomeProperty() or getSomeProperty().\n *\n * @getter false\n * @setter false\n */\nprotected $someProperty;\n```\n\n### Force a Type or Class\nYou can specify a type for the property using `@var` annotation variable, so setter will take only a value of this type, else it will throw an exception. The code below will work similar as \u003ccode\u003epublic function setSomeProperty(stdClass $value){}\u003c/code\u003e\n\n```PHP\n/**\n * Should be an instance of stdClass only.\n *\n * @var \\stdClass\n */\nprotected $shouldBeStdClass;\n```\n___\n```PHP\n/**\n * Should be an array only.\n *\n * @var Array\n */\nprotected $shouldBeArray;\n```\n___\n```PHP\n/**\n * Should be a string only\n *\n * @var String\n */\nprotected $shouldBeString;\n```\n___\n```PHP\n/**\n * Should be a number only.\n *\n * @var Number\n */\nprotected $shouldBeNumber;\n```\n___\n```PHP\n/**\n * Should be an object only.\n *\n * @var Object\n */\nprotected $shouldBeObject;\n```\n\n## Notes\n\nGetSetGo assumes that you use proper camelCase. So name your properties like `$pdoInstance` (not `$PDOInstance`) and call `setPdoInstance()` method.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusmanhalalit%2Fgetsetgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusmanhalalit%2Fgetsetgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusmanhalalit%2Fgetsetgo/lists"}