php8.5
Home/ Manual/ yaf / yaf_dispatcher/ Yaf_Dispatcher::getInstance

Yaf_Dispatcher::getInstance

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Retrieve the dispatcher instance

Description

Yaf_Dispatcher::getInstance(): Yaf_Dispatcher|null

Retrieve the single Yaf_Dispatcher instance.

Parameters Parameters

Return Values

The Yaf_Dispatcher instance, or null if no Yaf_Application has been initialized yet.

Examples

Yaf_Dispatcher::getInstance example

php
<?php
$app = new Yaf_Application(dirname(__FILE__) . "/conf/application.ini");

$dispatcher = Yaf_Dispatcher::getInstance();

var_dump($dispatcher === Yaf_Dispatcher::getInstance());
?>

The above example will output something similar to:

output
bool(true)

See Also

  • Yaf_Application::getDispatcher

Source: reference/yaf/yaf_dispatcher/getinstance.xml · from the official PHP manual (php/doc-en)