Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<Yaf_Session::setYaf_Session::__unset>
^Yaf_SessionLast updated: Mon, 26 Oct 2026

Yaf_Session::start

(Yaf >=1.0.0)

Yaf_Session::start — Start the session

Description

public function Yaf_Session::start(): Yaf_Session

Starts the session if it has not been started yet. This calls PHP's native session start mechanism. Calling this method multiple times is safe.

Parameters

This function has no parameters.

Return Values

Returns the Yaf_Session instance.

Examples

Example #1 Yaf_Session::start() example

<?php
// typically done once per request, e.g. in a bootstrap
$session = Yaf_Session::getInstance();
$session->start();

$session->set("user_id", 42);
echo $session->get("user_id");
?>

See Also


<Yaf_Session::setYaf_Session::__unset>
^Yaf_SessionLast updated: Mon, 26 Oct 2026