tomnomnom / phpsecuritytxt
A parser for security.txt files
0.0.2
2017-10-08 10:19 UTC
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-11-23 01:21:21 UTC
README
Work in progress.
Install
Install from packagist:
▶ composer require tomnomnom/phpsecuritytxt
Usage
Parse a security.txt
file:
<?php $raw = file_get_contents("test/fixtures/basic.txt"); $sectxt = new \SecurityTxt\Parser($raw);
You can create and empty object and call parse()
instead:
<?php $raw = file_get_contents("test/fixtures/basic.txt"); $sectxt = new \SecurityTxt\Parser(); $sectxt->parse($raw);
Get contact info:
<?php foreach ($sectxt->contact() as $contact){ echo "Contact: {$contact}\n"; }
Get encryption info:
<?php foreach ($sectxt->encryption() as $encryption){ echo "Encryption link: {$encryption}\n"; }
Get acknowledgement info:
<?php foreach ($sectxt->acknowledgement() as $acknowledgement){ echo "Acknowledgement link: {$acknowledgement}\n"; }
Get parser errors:
<?php foreach ($sectxt->errors() as $error){ echo "Error: {$error}\n"; }
Get comments:
<?php foreach ($sectxt->comments() as $comment){ echo "Comment: {$comment}\n"; }
TODO
- Add support for fetching URLs directly
- Improve test coverage
- Set up travis to run tests