I don’t knwo the relationship between session_config, session_manager and session_storage.
According to document Session Manager - laminas-session - Laminas Docs
I made my configuration like:
'session_config' => [
'cache_expire' => 60 * 24 * 30,
'cookie_httponly' => true,
'cookie_lifetime' => 86400 * 30,
'gc_maxlifetime' => 86400 * 30,
'name' => 'mysite',
'remember_me_seconds' => 86400 * 30,
'use_cookies' => true,
],
'session_manager' => [
'config' => [
'class' => Laminas\Session\Config\SessionConfig::class,
'options' => [
'name' => 'mysite',
],
],
'storage' => Laminas\Session\Storage\SessionArrayStorage::class,
'validators' => [
Laminas\Session\Validator\RemoteAddr::class,
Laminas\Session\Validator\HttpUserAgent::class,
],
],
However when I inject like the following, it raise error
class ImagerotateauthController extends AbstractActionController
{
public $sessionManager;
public function __construct(SessionManager $sessionManager)
{
$this->sessionManager = $sessionManager;
}
error:
Message:
Configuration is missing a "session_storage" key, or the value of that key is not an array
So I am confused about the relationship between them. even the others with session_manager
As we can see, in the key session_manager, it set config and storage and validator.
config should be session_config, storage should be session_storage, it seem I just need to config session_manager will be all ok.
I don’t know why, I am sure my understanding is incorrent, but really confused.
Besides, I found antoher page Usage in a laminas-mvc application - laminas-session - Laminas Docs
In this part, there is a full guide to config the session in the mvc mode.
However I still don’t know what’s the usage of the sessionManager. I used to new a session Container. not using sessionManager at all.
In this page Session Manager - laminas-session - Laminas Docs
It introduced a lot of code in module.php, what’s the usage of them?