PHP Class yii\gii\Module

To use Gii, include it as a module in the application configuration like the following: ~~~ return [ 'bootstrap' => ['gii'], 'modules' => [ 'gii' => ['class' => 'yii\gii\Module'], ], ] ~~~ Because Gii generates new code files on the server, you should only use it on your own development machine. To prevent other people from using this module, by default, Gii can only be accessed by localhost. You may configure its [[allowedIPs]] property if you want to make it accessible on other machines. With the above configuration, you will be able to access GiiModule in your browser using the URL http://localhost/path/to/index.php?r=gii If your application enables [[\yii\web\UrlManager::enablePrettyUrl|pretty URLs]], you can then access Gii via URL: http://localhost/path/to/index.php/gii
Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends yii\base\Module, implements yii\base\BootstrapInterface
Datei anzeigen Open project: yiisoft/yii2-gii Class Usage Examples

Public Properties

Property Type Description
$allowedIPs the list of IPs that are allowed to access this module. Each array element represents a single IP filter which can be either an IP address or an address with wildcard (e.g. 192.168.0.*) to represent a network segment. The default value is ['127.0.0.1', '::1'], which means the module can only be accessed by localhost.
$controllerNamespace
$generators a list of generator configurations or instances. The array keys are the generator IDs (e.g. "crud"), and the array elements are the corresponding generator configurations or the instances. After the module is initialized, this property will become an array of generator instances which are created based on the configurations previously taken by this property. Newly assigned generators will be merged with the [[coreGenerators()|core ones]], and the former takes precedence in case when they have the same generator ID.
$newDirMode the permission to be set for newly generated directories. This value will be used by PHP chmod function. Defaults to 0777, meaning the directory can be read, written and executed by all users.
$newFileMode the permission to be set for newly generated code files. This value will be used by PHP chmod function. Defaults to 0666, meaning the file is read-writable by all users.

Public Methods

Method Description
beforeAction ( $action )
bootstrap ( $app )

Protected Methods

Method Description
checkAccess ( ) : boolean
coreGenerators ( ) : array Returns the list of the core code generator configurations.
defaultVersion ( )
resetGlobalSettings ( ) Resets potentially incompatible global settings done in app config.

Method Details

beforeAction() public method

public beforeAction ( $action )

bootstrap() public method

public bootstrap ( $app )

checkAccess() protected method

protected checkAccess ( ) : boolean
return boolean whether the module can be accessed by the current user

coreGenerators() protected method

Returns the list of the core code generator configurations.
protected coreGenerators ( ) : array
return array the list of the core code generator configurations.

defaultVersion() protected method

Since: 2.0.6
protected defaultVersion ( )

resetGlobalSettings() protected method

Resets potentially incompatible global settings done in app config.
protected resetGlobalSettings ( )

Property Details

$allowedIPs public_oe property

the list of IPs that are allowed to access this module. Each array element represents a single IP filter which can be either an IP address or an address with wildcard (e.g. 192.168.0.*) to represent a network segment. The default value is ['127.0.0.1', '::1'], which means the module can only be accessed by localhost.
public $allowedIPs

$controllerNamespace public_oe property

public $controllerNamespace

$generators public_oe property

a list of generator configurations or instances. The array keys are the generator IDs (e.g. "crud"), and the array elements are the corresponding generator configurations or the instances. After the module is initialized, this property will become an array of generator instances which are created based on the configurations previously taken by this property. Newly assigned generators will be merged with the [[coreGenerators()|core ones]], and the former takes precedence in case when they have the same generator ID.
public $generators

$newDirMode public_oe property

the permission to be set for newly generated directories. This value will be used by PHP chmod function. Defaults to 0777, meaning the directory can be read, written and executed by all users.
public $newDirMode

$newFileMode public_oe property

the permission to be set for newly generated code files. This value will be used by PHP chmod function. Defaults to 0666, meaning the file is read-writable by all users.
public $newFileMode