{"id":19746963,"url":"https://github.com/jordanbrauer/php-registry","last_synced_at":"2026-05-11T21:35:13.531Z","repository":{"id":141962351,"uuid":"89265688","full_name":"jordanbrauer/php-registry","owner":"jordanbrauer","description":"A simple implementation of a static registry class to store global application key/values.","archived":false,"fork":false,"pushed_at":"2017-12-04T22:32:53.000Z","size":575,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-10T20:53:09.185Z","etag":null,"topics":["composer","library","package","php","registry","storage","store"],"latest_commit_sha":null,"homepage":null,"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/jordanbrauer.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-24T16:58:30.000Z","updated_at":"2024-01-15T06:37:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"c697cd2e-1c97-4c21-b818-2d8059168b71","html_url":"https://github.com/jordanbrauer/php-registry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jordanbrauer%2Fphp-registry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jordanbrauer%2Fphp-registry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jordanbrauer%2Fphp-registry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jordanbrauer%2Fphp-registry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jordanbrauer","download_url":"https://codeload.github.com/jordanbrauer/php-registry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241078435,"owners_count":19905855,"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":["composer","library","package","php","registry","storage","store"],"created_at":"2024-11-12T02:16:21.046Z","updated_at":"2026-05-11T21:35:08.488Z","avatar_url":"https://github.com/jordanbrauer.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-registry\n\nA simple implementation of a static registry class to store global application key/values.\n\n## Getting Started\n\n```shell\n$ git clone https://github.com/jordanbrauer/php-registry.git\n$ cd php-registry\n$ composer install --optimize-autoloader\n```\n\n## Example Usage\n\nBelow you will find example usage (also found in the `index.php` file) of the Registry and its' API.\n\n### Initialize a Registry\n\n\u003e`Registry::__init()`\n\nStart a new instance of the Registry (do this in your bootstrap code to have the rest of your application have access to this instance).\n\n```php\nRegistry::__init();\n```\n\n_Note: Regular usage like `$Registry = new Registry();` will throw an error due to proteced `__construct()` function._\n\n### Add Data to Registry\n\n\u003e`Registry::add(string $key, mixed $value)`\n\nAdd anything you want to the registry such as strings, integers, booleans, arrays, and objects.\n\n```php\nRegistry::add('string', 'Hello World!');\nRegistry::add('integer', 1);\nRegistry::add('boolean', true);\nRegistry::add('array', ['one', 'two', 'three']);\nRegistry::add('object', new DateTime());\n```\n\n### Remove Data from Registry\n\n\u003e`Registry::remove(string $key)`\n\nRemove any data from the registry by passing the property name to the remove method.\n\n```php\nRegistry::add('foo', 'delete me!');\nRegistry::add('bar', 'keep me!');\n\nRegistry::remove('foo');\n```\n\n### Check if Data is Stored\n\n\u003e`Registry::stored(string $key)`\n\nYou can check if an object or any kind of data is already stored in the registry before doing something with it. This method will return a boolean.\n\n```php\nRegistry::stored('foo'); // returns false\nRegistry::stored('bar'); // returns true\n```\n\n### Retrive Data from Registry\n\n\u003e`Registry::load(string $key)`\n\nRetrieve a value from the registry for use in your script. You will have to `echo`/`print`/`print_r`/`var_dump` the result yourself as this method only returns the value of the property being loaded.\n\n```php\nRegistry::load('string'); // returns 'Hello World!'\n```\n\n### Dump Contents of Registry\n\n\u003e`Registry::output()`\n\nIf for whatever reason you need the entire contents of the registry, you can do so by doing the following.\n\n```php\nvar_dump(Registry::output());\n```\n\n### Try it Yourself!\n\nRun the `index.php` file from your command line to get the example out.\n\n```shell\n$ php -f index.php\n```\n\u003e `output`\n```\narray(1) {\n  [\"store\"]=\u003e\n  array(6) {\n    [\"string\"]=\u003e\n    string(12) \"Hello World!\"\n    [\"integer\"]=\u003e\n    int(1)\n    [\"boolean\"]=\u003e\n    bool(true)\n    [\"array\"]=\u003e\n    array(3) {\n      [0]=\u003e\n      string(3) \"one\"\n      [1]=\u003e\n      string(3) \"two\"\n      [2]=\u003e\n      string(5) \"three\"\n    }\n    [\"object\"]=\u003e\n    object(DateTime)#2 (3) {\n      [\"date\"]=\u003e\n      string(26) \"2017-04-24 12:41:57.000000\"\n      [\"timezone_type\"]=\u003e\n      int(3)\n      [\"timezone\"]=\u003e\n      string(15) \"America/Chicago\"\n    }\n    [\"bar\"]=\u003e\n    string(8) \"keep me!\"\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjordanbrauer%2Fphp-registry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjordanbrauer%2Fphp-registry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjordanbrauer%2Fphp-registry/lists"}