Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/infinityloop-dev/robots
:wrench: Robots.txt generator component for Nette framework.
https://github.com/infinityloop-dev/robots
component nette php robots-txt
Last synced: about 1 month ago
JSON representation
:wrench: Robots.txt generator component for Nette framework.
- Host: GitHub
- URL: https://github.com/infinityloop-dev/robots
- Owner: infinityloop-dev
- License: mit
- Created: 2018-04-17T11:34:16.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-12T20:46:33.000Z (over 4 years ago)
- Last Synced: 2024-11-13T14:17:37.601Z (about 2 months ago)
- Topics: component, nette, php, robots-txt
- Language: PHP
- Homepage: https://www.infinityloop.dev
- Size: 19.5 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Robots
:wrench: Robots generator component## Introduction
This componenet automaticaly generates robots from parameters in configuration.
## Dependencies
- [nette/application](https://github.com/nette/application)
## How to use
- Register `\Nepttune\Component\IRobotsFactory` as service in cofiguration file, inject it into presenter, write `createComponent` method and use macro `{control}` in template file.
- Just as any other component.
- You need to pass robots configuration to factory service.
- Content type is automaticaly set to `text/plain`.
- Modify parameters to accomplish your needs.### Example configuration
```
services:
robotsFactory:
implement: Nepttune\Component\IRobotsFactory
arguments:
- '%robots%'
parameters:
robots:
all:
name: '*'
disallow:
google:
name 'GoogleBot'
disallow:
- '/example'
- '/example2'
```### Example presenter
```
class ExamplePresenter implements IPresenter
{
/** @var \Nepttune\Component\IRobotsFactory */
protected $iRobotsFactory;
public function __construct(\Nepttune\Component\IRobotsFactory $IRobotsFactory)
{
$this->iRobotsFactory = $IRobotsFactory;
}protected function createComponentRobots() : \Nepttune\Component\Robots
{
return $this->iRobotsFactory->create();
}
}
```