-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 5 - Roadmap #7
Comments
I learned a lot about separation of concerns in the last few days: https://java-design-patterns.com/principles/#separation-of-concerns What you think about implementing Neoflow/FlashMessages or Slim/Flash, instead of creating a integrated flash messages support? |
I have already played with the idea to sepearte the Flash component but also wanted to "keep it simple" at the same time. Most session implementations come with their built-in Flash functionality (see Symfony, Aura, etc.). On the other hand you should be able to use your own Flash component in combination with this component (see Readme). The new readme contains a section how to integrate the https://github.com/odan/session#slim-flash-integration The downside of this concept is, that they don't share the same FlashInterface. There is also a new FlashInterface which could be implemented. But it's also important that both components a sharing or abstracting the same storage interface to make it interobable. Of course we could provide a Adapter for it. Maybe I add a proof of concept. Do you have a good idea / concept how you can make it very easy to integrate other Flash components like yours? |
I think a specific FlashInterface is the easiest way to go, by providing a constructor argument and/or a set method Example with set method: SessionInterface::class => function (ContainerInterface $container) {
$settings = $container->get('settings');
$flash = $container->get(FlashInterface::class);
$session = new PhpSession();
$session->setOptions((array)$settings['session']);
$session->setFlash($flash);
return $session;
}, Example with constructor argument: SessionInterface::class => function (ContainerInterface $container) {
$settings = $container->get('settings');
$flash = $container->get(FlashInterface::class);
$session = new PhpSession($flash);
$session->setOptions((array)$settings['session']);
return $session;
}, I would prefer to provide both options. And if no custom flash got set, the session uses the default flash solution. |
But to be honest, I would skip the flash messages and keep focused on the session library itself. |
@odan While you are still building out these changes, could you add a couple of methods? Thanks |
Congratulations! I really like the simpleness of the flash support. |
Thanks to all for the feedback. |
Here are some initial ideas:
Breaking Changes
Move all interface into its own namespace:⛔Odan\Session\Interfaces
SessionDoublePassMiddleware
✔️Rename class⛔PhpSession
toSession
Remove⛔MemorySession
classSessionMiddleware
into its own namespace:Odan\Session\Middleware
✔️Add a native PHP session cookie handler, e.g.⛔Odan\Session\Cookie
Remove⛔setCookieParams
andgetCookieParams
Move this library to selective/session⛔New Features
Add support for dot notation using selective/array-reader⛔SessionException
instead of returning false for errors ✔️Please add additional thoughts below.
The text was updated successfully, but these errors were encountered: