Skip to content

Commit a22ae0d

Browse files
authored
Update README.md
1 parent 9bb6cca commit a22ae0d

File tree

1 file changed

+67
-2
lines changed

1 file changed

+67
-2
lines changed

README.md

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,67 @@
1-
# security
2-
:wrench: Robots generator component
1+
# Security
2+
:wrench: Security generator component
3+
4+
![Packagist](https://img.shields.io/packagist/dt/nepttune/security.svg)
5+
![Packagist](https://img.shields.io/packagist/v/nepttune/security.svg)
6+
[![CommitsSinceTag](https://img.shields.io/github/commits-since/nepttune/robots/v1.0.svg?maxAge=600)]()
7+
8+
[![Code Climate](https://codeclimate.com/github/nepttune/security/badges/gpa.svg)](https://codeclimate.com/github/nepttune/security)
9+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nepttune/security/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/nepttune/security/?branch=master)
10+
11+
## Introduction
12+
13+
This component automaticaly generates security.txt from parameters in configuration.
14+
15+
## Dependencies
16+
17+
- [nepttune/base-requirements](https://github.com/nepttune/base-requirements)
18+
- [nepttune/base-component](https://github.com/nepttune/base-component)
19+
20+
## How to use
21+
22+
- Register `\Nepttune\Component\ISecurityFactory` as service in cofiguration file, inject it into presenter, write `createComponent` method and use macro `{control}` in template file.
23+
- Just as any other component.
24+
- You need to pass security configuration to factory service.
25+
- Content type is automaticaly set to `text/plain`.
26+
- Modify parameters to accomplish your needs.
27+
28+
### Example configuration
29+
30+
```
31+
services:
32+
securityFactory:
33+
implement: Nepttune\Component\ISecurityFactory
34+
arguments:
35+
- '%security%'
36+
parameters:
37+
security:
38+
contact: '[email protected]'
39+
hiring: 'https://hiring.test.com'
40+
acknowledgements: 'https://hall-of-fame.test.com'
41+
permission: 'none'
42+
```
43+
44+
### Example presenter
45+
46+
```
47+
class ExamplePresenter implements IPresenter
48+
{
49+
/** @var \Nepttune\Component\IRobotsFactory */
50+
protected $iRobotsFactory;
51+
52+
public function __construct(\Nepttune\Component\IRobotsFactory $IRobotsFactory)
53+
{
54+
$this->iRobotsFactory = $IRobotsFactory;
55+
}
56+
57+
public function actionRobots()
58+
{
59+
$this->getHttpResponse()->setContentType('text/plain');
60+
}
61+
62+
protected function createComponentRobots()
63+
{
64+
return $this->iRobotsFactory->create();
65+
}
66+
}
67+
```

0 commit comments

Comments
 (0)