PHP code example of anatoliy700 / yii2-robots
1. Go to this page and download the library: Download anatoliy700/yii2-robots library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
anatoliy700 / yii2-robots example snippets
'modules' => [
'robots' => [
'class' => 'anatoliy700\robots\Module',
]
]
'bootstrap' => ['robots']
'container' => [
'definitions' => [
'anatoliy700\robots\IRobots' => [
'class' => 'anatoliy700\robots\Robots',
'directives' => [
'User-Agent' => '*',
'Disallow' => [
'/backend',
],
],
],
'anatoliy700\robots\directives\IDirective' => 'anatoliy700\robots\directives\Directive',
],
]
'RobotsBehavior' => [
'class' => 'anatoliy700\robots\behaviors\RobotsModelBehaviors',
'route' => ['content/default/index', 'alias' => 'alias']
]
[['robotsBlockingFlag'], 'safe'],
<?= $form->field($model, 'robotsBlockingFlag')->checkbox()
'container' => [
'definitions' => [
'anatoliy700\robots\repositories\IRepository' => [
'class' => 'anatoliy700\robots\repositories\ActiveRecordRepository',
'activeRecord' => 'anatoliy700\robots\repositories\adapters\RedisAdapter',
],
],
]
'components' => [
'redis' => [
'class' => 'yii\redis\Connection',
'hostname' => 'REDIS_HOST',
'port' => 'REDIS_PORT',
'database' => 2,
],
]
'container' => [
'definitions' => [
'anatoliy700\robots\generators\IRouteGenerator' => [
'class' => 'anatoliy700\robots\generators\RouteGenerator',
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [...],
],
],
],
]