{"action":"created","issue":{"url":"https://api.github.com/repos/php-middleware/phpdebugbar/issues/23","repository_url":"https://api.github.com/repos/php-middleware/phpdebugbar","labels_url":"https://api.github.com/repos/php-middleware/phpdebugbar/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/php-middleware/phpdebugbar/issues/23/comments","events_url":"https://api.github.com/repos/php-middleware/phpdebugbar/issues/23/events","html_url":"https://github.com/php-middleware/phpdebugbar/issues/23","id":354030251,"node_id":"MDU6SXNzdWUzNTQwMzAyNTE=","number":23,"title":"factories use container as service locator and uses classnames as keys..","user":{"login":"ppetermann","id":69334,"node_id":"MDQ6VXNlcjY5MzM0","avatar_url":"https://avatars0.githubusercontent.com/u/69334?v=4","gravatar_id":"","url":"https://api.github.com/users/ppetermann","html_url":"https://github.com/ppetermann","followers_url":"https://api.github.com/users/ppetermann/followers","following_url":"https://api.github.com/users/ppetermann/following{/other_user}","gists_url":"https://api.github.com/users/ppetermann/gists{/gist_id}","starred_url":"https://api.github.com/users/ppetermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ppetermann/subscriptions","organizations_url":"https://api.github.com/users/ppetermann/orgs","repos_url":"https://api.github.com/users/ppetermann/repos","events_url":"https://api.github.com/users/ppetermann/events{/privacy}","received_events_url":"https://api.github.com/users/ppetermann/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-25T17:39:58Z","updated_at":"2018-10-10T11:06:18Z","closed_at":null,"author_association":"NONE","body":"I just stumbled over the middleware and was surprised that the docs said it supports psr-11, wondering what  it would load through it.\r\n\r\nA quick look at the code revealed several issues:\r\n * the factory classes all use the container in a ServiceLocator anti-pattern, which is discouraged in [psr-11 section.13](https://www.php-fig.org/psr/psr-11).\r\n* the identifier within the container is a classname, a better way would be to use an interface here, and then have the classes implementing the service stored for that interface.\r\n* for configuration the key \"config\" is used, which might conflict with the config of some frameworks, furthermore, there is no clear interface, o and even worse the provided ConfigProvider is final, and loads static confic files from its own config dir, that are meant for a specific framework, thus making it a necessity to replace the not-mentioned interfaceless config provider with your own.\r\n"},"comment":{"url":"https://api.github.com/repos/php-middleware/phpdebugbar/issues/comments/428531649","html_url":"https://github.com/php-middleware/phpdebugbar/issues/23#issuecomment-428531649","issue_url":"https://api.github.com/repos/php-middleware/phpdebugbar/issues/23","id":428531649,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODUzMTY0OQ==","user":{"login":"snapshotpl","id":312655,"node_id":"MDQ6VXNlcjMxMjY1NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/312655?v=4","gravatar_id":"","url":"https://api.github.com/users/snapshotpl","html_url":"https://github.com/snapshotpl","followers_url":"https://api.github.com/users/snapshotpl/followers","following_url":"https://api.github.com/users/snapshotpl/following{/other_user}","gists_url":"https://api.github.com/users/snapshotpl/gists{/gist_id}","starred_url":"https://api.github.com/users/snapshotpl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snapshotpl/subscriptions","organizations_url":"https://api.github.com/users/snapshotpl/orgs","repos_url":"https://api.github.com/users/snapshotpl/repos","events_url":"https://api.github.com/users/snapshotpl/events{/privacy}","received_events_url":"https://api.github.com/users/snapshotpl/received_events","type":"User","site_admin":false},"created_at":"2018-10-10T11:06:18Z","updated_at":"2018-10-10T11:06:18Z","author_association":"MEMBER","body":"@ppetermann thanks your feedback\r\n1. As injecting container into your classes is anti-pattern - that's usage in this package is absolutely right. Provided factories exists on \"container\" level - can be use to build object using object, following container implementation. See how zend-servicemanager, pimple create services - by invokable objects. There isn't any other object where container is injected.\r\n2. Can you provide example?\r\n3. `config` key - you have right. It can be done better. However what is problem with final class and loading config from file? Provided config is just default set of data - you should get it and modify by your needs."}}
{"actor":{"display_login":"snapshotpl"}}