SessionIdInterface

SessionIdInterface is an optional interface a session handler can implement to generate its own session IDs. It defines a single method create_sid(): string returning a new unique session identifier.

When PHP needs a new session ID and the handler implements this interface, create_sid() is called instead of the built-in ID generation.

<?php

    class CustomSessionHandler implements SessionHandlerInterface, SessionIdInterface {
        public function create_sid(): string {
            return bin2hex(random_bytes(16));
        }
        // ... implement remaining SessionHandlerInterface methods
    }

?>

Documentation

Related : Session, Interface, PHP Native Interfaces, SessionHandlerInterface, SplSubject

Added in PHP 5.5.1