{"id":19571758,"url":"https://github.com/loadsys/cakephp-libregistry","last_synced_at":"2025-07-03T02:34:21.974Z","repository":{"id":62518499,"uuid":"40206075","full_name":"loadsys/CakePHP-LibRegistry","owner":"loadsys","description":"Provides a non-Cake registry singleton to store and load library class instances across a Cake app. Similar to TableRegistry, but for stand-alone PHP libraries.","archived":false,"fork":false,"pushed_at":"2016-09-29T16:23:03.000Z","size":23,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-04T20:51:19.391Z","etag":null,"topics":[],"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/loadsys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-04T19:56:21.000Z","updated_at":"2019-08-18T16:49:18.000Z","dependencies_parsed_at":"2022-11-02T13:45:55.971Z","dependency_job_id":null,"html_url":"https://github.com/loadsys/CakePHP-LibRegistry","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadsys%2FCakePHP-LibRegistry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadsys%2FCakePHP-LibRegistry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadsys%2FCakePHP-LibRegistry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadsys%2FCakePHP-LibRegistry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loadsys","download_url":"https://codeload.github.com/loadsys/CakePHP-LibRegistry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251085145,"owners_count":21533821,"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-11T06:19:56.651Z","updated_at":"2025-04-27T03:32:36.868Z","avatar_url":"https://github.com/loadsys.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CakePHP LibRegistry Plugin\n\n[![Packagist Version](https://img.shields.io/packagist/v/loadsys/CakePHP-LibRegistry.svg?style=flat-square)](https://packagist.org/packages/loadsys/cakephp-libregistry)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/loadsys/CakePHP-LibRegistry/master.svg?style=flat-square)](https://travis-ci.org/loadsys/CakePHP-LibRegistry)\n[![Coverage Status](https://img.shields.io/coveralls/loadsys/CakePHP-LibRegistry/master.svg?style=flat-square)](https://coveralls.io/r/loadsys/cakephp-libregistry)\n[![Total Downloads](https://img.shields.io/packagist/dt/loadsys/cakephp-libregistry.svg?style=flat-square)](https://packagist.org/packages/loadsys/cakephp-libregistry)\n\nThe LibRegistry provides a mechanism for loading and storing instances of non-Cake PHP libraries. It works a lot like Cake 3's `TableRegistry`. Object instances can be requested by name and instantiated automatically, or can be loaded into the registry manually.\n\n\n## Requirements\n\n* CakePHP 3.0+\n\n\n## Installation\n\n### Composer\n\n````bash\n$ composer require loadsys/cakephp-libregistry:~1.0\n````\n\n\n## Usage\n\n* Invoke the LibRegistry statically:\n\n\t```php\n\t\u003c?php\n\n\tnamespace App\\Whatever;\n\n\tuse LibRegistry\\LibRegistry;\n\n\tclass MyController extends Controller {\n\t\tpublic function index() {\n\t\t\t$myObj = LibRegistry::get('MyObj', ['configs' =\u003e 'here']);\n\t\t\t// (Where the class `src/Lib/MyObj.php` exists.)\n\t\t\t$myObj-\u003edoSomethingNeat();\n\t\t}\n\t}\n\n\t```\n\n* A trait is also provided to load libraries into existing classes:\n\n\t```php\n\t\u003c?php\n\n\tnamespace App\\Whatever;\n\n\tuse LibRegistry\\LibRegistryTrait;\n\n\tclass MyController extends Controller {\n\t\tuse LibRegistryTrait;\n\t\tpublic function index() {\n\t\t\t$this-\u003eloadLib('MyObj', ['configs' =\u003e 'here']);\n\t\t\t$this-\u003eMyObj-\u003edoSomethingNeat();\n\t\t\t// Works like loadComponent() in this context.\n\t\t}\n\t}\n\n\t```\n\n### Library classes\n\n* Must exist in `src/Lib/` in your Cake app or plugin and must be namespaced appropriately.\n\n* Must accept a single array of config values as the sole `__construct()` argument. Libraries that don't conform to this interface can't be instantiated via `LibRegistry::get()`, although they can still be stored in the Registry manually via `::set()`.\n\n\n## Contributing\n\n### Code of Conduct\n\nThis project has adopted the Contributor Covenant as its [code of conduct](CODE_OF_CONDUCT.md). All contributors are expected to adhere to this code. [Translations are available](http://contributor-covenant.org/).\n\n### Reporting Issues\n\nPlease use [GitHub Isuses](https://github.com/loadsys/CakePHP-LibRegistry/issues) for listing any known defects or issues.\n\n### Development\n\nPlease fork and issue a PR targeting the `master` branch for any new development.\n\nThe full test suite for the plugin can be run via this command:\n\n```shell\n$ vendor/bin/phpunit\n```\n\nCode must conform to the Loadsys coding standard, which is based on the CakePHP coding standard:\n\n```shell\n$ vendor/bin/phpcs --config-set installed_paths vendor/cakephp/cakephp-codesniffer,vendor/loadsys/loadsys_codesniffer\n$ vendor/bin/phpcs -p --standard=Loadsys src\n```\n\n\n## License\n\n[MIT](https://github.com/loadsys/CakePHP-LibRegistry/blob/master/LICENSE.md)\n\n\n## Copyright\n\n[Loadsys Web Strategies](http://www.loadsys.com) 2016\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floadsys%2Fcakephp-libregistry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floadsys%2Fcakephp-libregistry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floadsys%2Fcakephp-libregistry/lists"}