{"action":"created","issue":{"url":"https://api.github.com/repos/slimphp/Slim/issues/1148","labels_url":"https://api.github.com/repos/slimphp/Slim/issues/1148/labels{/name}","comments_url":"https://api.github.com/repos/slimphp/Slim/issues/1148/comments","events_url":"https://api.github.com/repos/slimphp/Slim/issues/1148/events","html_url":"https://github.com/slimphp/Slim/issues/1148","id":66095124,"number":1148,"title":"CookiesInterface unnecessary?","user":{"login":"JoeBengalen","id":11173689,"avatar_url":"https://avatars.githubusercontent.com/u/11173689?v=3","gravatar_id":"","url":"https://api.github.com/users/JoeBengalen","html_url":"https://github.com/JoeBengalen","followers_url":"https://api.github.com/users/JoeBengalen/followers","following_url":"https://api.github.com/users/JoeBengalen/following{/other_user}","gists_url":"https://api.github.com/users/JoeBengalen/gists{/gist_id}","starred_url":"https://api.github.com/users/JoeBengalen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoeBengalen/subscriptions","organizations_url":"https://api.github.com/users/JoeBengalen/orgs","repos_url":"https://api.github.com/users/JoeBengalen/repos","events_url":"https://api.github.com/users/JoeBengalen/events{/privacy}","received_events_url":"https://api.github.com/users/JoeBengalen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-04-03T07:13:26Z","updated_at":"2015-04-03T10:53:59Z","closed_at":null,"body":"Since the `Http\\Cookies` only contains static helper methods, why is there still an interface defined? The class does not even implement the interface. (see https://github.com/slimphp/Slim/blob/develop/Slim/Http/Cookies.php#L14)"},"comment":{"url":"https://api.github.com/repos/slimphp/Slim/issues/comments/89252273","html_url":"https://github.com/slimphp/Slim/issues/1148#issuecomment-89252273","issue_url":"https://api.github.com/repos/slimphp/Slim/issues/1148","id":89252273,"user":{"login":"codeguy","id":31677,"avatar_url":"https://avatars.githubusercontent.com/u/31677?v=3","gravatar_id":"","url":"https://api.github.com/users/codeguy","html_url":"https://github.com/codeguy","followers_url":"https://api.github.com/users/codeguy/followers","following_url":"https://api.github.com/users/codeguy/following{/other_user}","gists_url":"https://api.github.com/users/codeguy/gists{/gist_id}","starred_url":"https://api.github.com/users/codeguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeguy/subscriptions","organizations_url":"https://api.github.com/users/codeguy/orgs","repos_url":"https://api.github.com/users/codeguy/repos","events_url":"https://api.github.com/users/codeguy/events{/privacy}","received_events_url":"https://api.github.com/users/codeguy/received_events","type":"User","site_admin":false},"created_at":"2015-04-03T10:53:59Z","updated_at":"2015-04-03T10:53:59Z","body":"The clean solution appears to be this: creating new cookies means storing the cookie data in a separate, stand-alone object (via service provider). This object is in no way contained by or related to the response object. I imagine a shared Pimple service that looks like this:\r\n\r\n```php\r\n$app['cookies']->set('name', ['value' => 'foo', 'domain' => 'example.com', 'expires' => '3 days']);\r\n````\r\n\r\nThe middleware layer is responsible for 1) unserializing the Request `Cookie` header, and 2) serializing the cookie data from the service provider above into HTTP `Set-Cookie` headers. I don't like how this is separated from the Response object; it feels wrong, but I think it's the best solution.\r\n\r\nAside: For middleware and service providers that work together like this, do you still prefer adding them to the application separately (e.g., `$app->add(middleware)` _and_ `$app->register(provider)`) or is there a way to add them both at once?"}}