{"id":21819365,"url":"https://github.com/dflydev/dflydev-psr0-resource-locator","last_synced_at":"2025-04-14T02:29:00.506Z","repository":{"id":5124510,"uuid":"6289730","full_name":"dflydev/dflydev-psr0-resource-locator","owner":"dflydev","description":"PSR-0 Resource Locator","archived":false,"fork":false,"pushed_at":"2014-07-16T21:18:52.000Z","size":177,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T02:28:47.265Z","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":"inverse-inc/sogo","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dflydev.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":"2012-10-19T04:18:24.000Z","updated_at":"2017-04-01T10:16:45.000Z","dependencies_parsed_at":"2022-08-21T09:50:42.288Z","dependency_job_id":null,"html_url":"https://github.com/dflydev/dflydev-psr0-resource-locator","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/dflydev%2Fdflydev-psr0-resource-locator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-psr0-resource-locator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-psr0-resource-locator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-psr0-resource-locator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dflydev","download_url":"https://codeload.github.com/dflydev/dflydev-psr0-resource-locator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248810783,"owners_count":21165180,"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-27T16:18:41.569Z","updated_at":"2025-04-14T02:29:00.475Z","avatar_url":"https://github.com/dflydev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"PSR-0 Resource Locator\n======================\n\nLocate resources by namespaceish paths using [PSR-0][1] mappings.\n\nLocating resources relative to a class within the same package can\nbe done by `__DIR__.'/../Resources`. The downside to this method is\nthat it only works if the target resources are in the same package.\n\nThis project aims to allow for locating resources from any namespace\nwhether the intended directory is in the same package or not.\n\nThe term *namespaceish* is used instead of namespace as it should be\nunderstood that we are overloading the [PSR-0][1] conventions to find\n*files* and not PHP code. In fact, we may often be looking for\ndirectories under a namespace that are in fact not namespaces at all.\n\n\nRequirements\n------------\n\n * PHP 5.3+\n * A PSR-0 Resource Locator Implementation \n    * Composer — [dflydev/psr0-resource-locator-composer][2]\n\nInstallation\n------------\n\nThis library can installed by [Composer][4].\n\n\nUsage\n-----\n\nThe following is an example using the Composer PSR-0 Resource\nLocator implementation ([dflydev/psr0-resource-locator-composer][2]):\n\n```php\n\u003c?php\n\nuse Dflydev\\Psr0ResourceLocator\\Composer\\ComposerResourceLocator;\n\n$resourceLocator = new ComposerResourceLocator;\n\n// Search all PSR-0 namespaces registered by Composer\n// to find the first directory found looking like:\n// \"/Vendor/Project/Resources/mappings\"\n$mappingDirectory = $resourceLocator-\u003efindFirstDirectory(\n    'Vendor\\Project\\Resources\\mappings'\n);\n\n// Search all PSR-0 namespaces registered by Composer\n// to find all templates directories looking like:\n// \"/Vendor/Project/Resources/templates\"\n$templateDirs = $resourceLocator-\u003efindDirectories(\n    'Vendor\\Project\\Resources\\templates',\n);\n\n```\n\nThe use of `Resources` in these examples is not meant to imply that\nonly `/Resources/` paths can be found. Implementations should be\ncapable of finding any directory/directories as long as they follow\n[PSR-0][1] naming guidelines *and the mapping was registered*.\n\n\nGotchas\n-------\n\nKeep in mind a few rules:\n\n * Only resources that *actually exist* will be returned.\n * The order in which namespaces are checked will be determined by\n   the underlying implementation. However, it is recommended that\n   implementations search more specific namespace prefixes first.\n   That is, `Foo\\Bar\\Baz` should be checked before `Foo\\Bar` if both\n   are registered.\n\n\nKnow Implementations\n--------------------\n\n### Composer — [dflydev/psr0-resource-locator-composer][2]\n\nThe Composer PSR-0 Resource Locator implementation leverages\n[dflydev/composer-autoload][3] to locate the effective Composer autoloader\nin use at runtime and accesses its namespace map.\n\nFor any project that uses Composer this is the implementation you are\nlooking for.\n\n\nImplementation Guidelines\n-------------------------\n\nEnsure that more specific namespace prefixes are searched first. That is,\n`Foo\\Bar\\Baz` should be checked before `Foo\\Bar` if both are registered.\n\n\nLicense\n-------\n\nMIT, see LICENSE.\n\n\nCommunity\n---------\n\nIf you have questions or want to help out, join us in the [#dflydev][5]\nchannel on irc.freenode.net.\n\n\nNot Invented Here\n-----------------\n\nBased on the `classpath:` concept from [Spring Framework][6].\n\n\n[1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md\n[2]: https://github.com/dflydev/dflydev-psr0-resource-locator-composer\n[3]: https://github.com/dflydev/dflydev-composer-autoload\n[4]: http://getcomposer.org/\n[5]: irc://irc.freenode.net/#dflydev\n[6]: http://www.springsource.org/spring-framework\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflydev%2Fdflydev-psr0-resource-locator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdflydev%2Fdflydev-psr0-resource-locator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflydev%2Fdflydev-psr0-resource-locator/lists"}