Yii2 Project Scanner
Yii2 Project Scanner Extension, (*1)
Installation
composer
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
composer require lajax/yii2-project-scanner
or add, (*4)
"lajax/yii2-project-scanner": "^1.0.0"
to the require section of your composer.json
file., (*5)
Usage
Configs
Minimal configs
[
'components' => [
// ...
'scanner' => lajax\projectscanner\Scanner::className(),
// ...
],
],
Full configs
[
'components' => [
// ...
'scanner' => [
'class' => lajax\projectscanner\Scanner::className(),
'scanTimeLimit' => null,
'ignoredCategories' => [],
'ignoredItems' => [
'.svn',
'.git',
'.gitignore',
'.gitattributes',
'.gitkeep',
'.hgignore',
'.hgkeep',
'/messages',
'/BaseYii.php',
'runtime',
'bower',
'nikic',
],
'roots' => [
'@backend',
'@common',
'@console',
'@frontend',
'@vendor',
],
'scanners' => [
'dbScanner' => [
'class' => lajax\projectscanner\scanners\DbScanner::className(),
'category' => 'database',
'tables' => [
[
'connection' => 'db',
'table' => 'language',
'columns' => ['name', 'name_ascii'],
'category' => 'tableName',
],
[
'connection' => 'db',
'table' => 'tag',
'columns' => ['name'],
'category' => 'tableName',
],
[
'connection' => 'db',
'table' => 'category',
'columns' => ['name', 'description'],
],
],
],
'jsScanner' => [
'class' => lajax\projectscanner\scanners\JsScanner::className(),
'extension' => '*.js',
'translators' => ['lajax.t'],
'category' => 'javascript',
],
'phpArrayScanner' => [
'class' => lajax\projectscanner\scanners\PhpArrayScanner::className(),
'extension' => '*.php',
'category' => 'array',
'patternArrayTranslator' => '#\@translate[^\$]+(?P<translator>[\w\d\s_]+[^\(\[]+)#s',
],
'phpFunctionScanner' => [
'class' => lajax\projectscanner\scanners\PhpFunctionScanner::className(),
'extension' => '*.php',
'translators' => ['::t'],
],
],
],
// ...
],
],
##Scanning project
```php
$scannerResult = \Yii::$app->scanner->execute();
result
$scannerResult->languageElements; *Array* List of language elements.
[
['category' => 'messageCategory', 'message' => 'languageElement'],
['category' => 'messageCategory', 'message' => 'languageElement'],
// ...
]
$scannerResult->numberOfLanguageElements; *Integer* Number of language elements.
$scannerResult->filteredLanguageElements; *Array* List of language elements.
[
'messageCategory' => [
'languageElement' => true
]
]
[
'messageCategory' => [
'languageElement' => true
]
]
[
'messageCategory' => [
'languageElement' => true
]
]
Links