PHP code example of nyx-solutions / yii2-nyx-robots

1. Go to this page and download the library: Download nyx-solutions/yii2-nyx-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/ */

    

nyx-solutions / yii2-nyx-robots example snippets


'components' => [
    'cache' => [
        'class' => 'yii\caching\FileCache',
    ],
]

'modules' => [
    'robots' => [
        'class' => 'nyx\modules\robots\Module',
        'settings' => [
            'disallowAllRobots' => false,
            'allowAllRobots'    => false,
            'useSitemap'        => true,
            'sitemapFile'       => '/sitemap.xml',
            'robots'            => [],
            'allowRules'        => [
                'all' => [
                    '/uploads'
                ]
            ],
            'disallowRules'     => [
                'all' => [
                    '/assets'
                ]
            ]
        ]
    ]
]

'urlManager' => [
    'rules' => [
        ['pattern' => 'robots', 'route' => 'robots/default/index', 'suffix' => '.txt'],
    ]
]