PHP code example of dotkernel / dot-session

1. Go to this page and download the library: Download dotkernel/dot-session library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dotkernel / dot-session example snippets


    $app->pipe(Dot\Session\SessionMiddleware::class);

    \Dot\Session\ConfigProvider::class,

class ExampleFactory
{
    // code
    
    public function __invoke(ContainerInterface $container)
    {
        return new ExampleService(
            $container->get(SessionManager::class)
        )
    }
}


class ExampleService
{
    private SessionManager $session;
    
    public function __construct(SessionManager $session) 
    {
        $this->session = $session;
    }
    
     //your methods
}

use Dot\AnnotatedServices\Annotation\Inject;
use Laminas\Session\SessionManager;

class ExampleService
{
    private SessionManager $session;
    
     /**
     * @Inject({SessionManager::class})
     */
    public function __construct(SessionManager $session) 
    {
        $this->session = $session;
    }
    
     //your methods
}