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

Yaf_Controller_Abstract::getName

PHP function Edit on GitHub ✎

(Yaf >=3.2.0)

Get controller name

Description

Yaf_Controller_Abstract::getName(): string|null

Returns the name of the controller.

Parameters Parameters

Return Values

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

Examples

Yaf_Controller_Abstract::getName example

php
<?php
class ProductController extends Yaf_Controller_Abstract
{
    public function indexAction() {
        // the controller name, without the "Controller" suffix
        var_dump($this->getName());
    }
}
?>

The above example will output something similar to:

output
string(7) "Product"

See Also

  • Yaf_Controller_Abstract::getModuleName
  • Yaf_Request_Abstract::getControllerName

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