php8.5
Home/ Manual/ yaf / yaf_controller_abstract/ Yaf_Controller_Abstract::getModuleName

Yaf_Controller_Abstract::getModuleName

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Get module name

Description

Yaf_Controller_Abstract::getModuleName(): string|null

Returns the name of the module the controller belongs to.

Parameters Parameters

Return Values

The module name as a String, or null if it is not set.

Examples

Yaf_Controller_Abstract::getModuleName example

php
<?php
class IndexController extends Yaf_Controller_Abstract
{
    public function indexAction() {
        // assuming the request was dispatched to the
        // default "Index" module
        var_dump($this->getModuleName());
    }
}
?>

The above example will output something similar to:

output
string(5) "Index"

See Also

  • Yaf_Controller_Abstract::getName
  • Yaf_Request_Abstract::getModuleName

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