|
| 1 | +# certificate |
| 2 | + |
| 3 | +[![Latest Version on Packagist][ico-version]][link-packagist] |
| 4 | +[![Software License][ico-license]](LICENSE.md) |
| 5 | +[![Build Status][ico-travis]][link-travis] |
| 6 | +[![Code Climate][ico-cc]][link-cc] |
| 7 | +[![Tests Coverage][ico-cc-coverage]][link-cc] |
| 8 | + |
| 9 | +Parsing of digital certificates from all Bulgarian vendors. |
| 10 | + |
| 11 | +## Install |
| 12 | + |
| 13 | +Via Composer |
| 14 | + |
| 15 | +``` bash |
| 16 | +$ composer require vakata/certificate |
| 17 | +``` |
| 18 | + |
| 19 | +## Usage |
| 20 | + |
| 21 | +``` php |
| 22 | +// parse the certificate from the current request ($_SERVER['SSL_CLIENT_CERT']) |
| 23 | +// on Apache this will work if SSLOptions +ExportCertData is set |
| 24 | +$cert = \vakata\certificate\BG::fromRequest(); |
| 25 | + |
| 26 | +// you can then get various information from the certificate |
| 27 | +if ($cert->isPersonal()) { |
| 28 | + echo $cert->getID(); // EGN or PID |
| 29 | +} |
| 30 | +if ($cert->isProfessional()) { |
| 31 | + echo $cert->getBulstat(); // EGN or PID |
| 32 | +} |
| 33 | + |
| 34 | +// you can also create an instance from a x509 string |
| 35 | +$certStr = new \vakata\certificate\BG("x509 formatted string"); |
| 36 | +// or from a file |
| 37 | +$certFile = \vakata\certificate\BG::fromFile("/path/to/file.crt"); |
| 38 | +``` |
| 39 | + |
| 40 | +Read more in the [API docs](docs/README.md) |
| 41 | + |
| 42 | +## Testing |
| 43 | + |
| 44 | +``` bash |
| 45 | +$ composer test |
| 46 | +``` |
| 47 | + |
| 48 | + |
| 49 | +## Contributing |
| 50 | + |
| 51 | +Please see [CONTRIBUTING](CONTRIBUTING.md) for details. |
| 52 | + |
| 53 | +## Security |
| 54 | + |
| 55 | +If you discover any security related issues, please email [email protected] instead of using the issue tracker. |
| 56 | + |
| 57 | +## Credits |
| 58 | + |
| 59 | +- [vakata][link-author] |
| 60 | +- [All Contributors][link-contributors] |
| 61 | + |
| 62 | +## License |
| 63 | + |
| 64 | +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
| 65 | + |
| 66 | +[ico-version]: https://img.shields.io/packagist/v/vakata/certificate.svg?style=flat-square |
| 67 | +[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square |
| 68 | +[ico-travis]: https://img.shields.io/travis/vakata/certificate/master.svg?style=flat-square |
| 69 | +[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/vakata/certificate.svg?style=flat-square |
| 70 | +[ico-code-quality]: https://img.shields.io/scrutinizer/g/vakata/certificate.svg?style=flat-square |
| 71 | +[ico-downloads]: https://img.shields.io/packagist/dt/vakata/certificate.svg?style=flat-square |
| 72 | +[ico-cc]: https://img.shields.io/codeclimate/github/vakata/certificate.svg?style=flat-square |
| 73 | +[ico-cc-coverage]: https://img.shields.io/codeclimate/coverage/github/vakata/certificate.svg?style=flat-square |
| 74 | + |
| 75 | +[link-packagist]: https://packagist.org/packages/vakata/certificate |
| 76 | +[link-travis]: https://travis-ci.org/vakata/certificate |
| 77 | +[link-scrutinizer]: https://scrutinizer-ci.com/g/vakata/certificate/code-structure |
| 78 | +[link-code-quality]: https://scrutinizer-ci.com/g/vakata/certificate |
| 79 | +[link-downloads]: https://packagist.org/packages/vakata/certificate |
| 80 | +[link-author]: https://github.com/vakata |
| 81 | +[link-contributors]: ../../contributors |
| 82 | +[link-cc]: https://codeclimate.com/github/vakata/certificate |
| 83 | + |
0 commit comments