Skip to content

Commit 9cf7371

Browse files
committed
initial commit
0 parents  commit 9cf7371

13 files changed

+670
-0
lines changed

.codeclimate.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
engines:
2+
phpcodesniffer:
3+
enabled: true
4+
config:
5+
file_extensions: "php"
6+
standard: "PSR1,PSR2"
7+
phpmd:
8+
enabled: true
9+
checks:
10+
CleanCode/BooleanArgumentFlag:
11+
enabled: false
12+
CleanCode/ElseExpression:
13+
enabled: false
14+
Naming/ShortVariable:
15+
enabled: false
16+
Design/TooManyMethods:
17+
enabled: false
18+
Design/NpathComplexity:
19+
enabled: false
20+
ratings:
21+
paths:
22+
- "**.php"
23+
exclude_paths:
24+
- tests/**/*

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.gitattributes

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.travis.yml export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/.scrutinizer.yml export-ignore
10+
/tests export-ignore

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build
2+
composer.lock
3+
vendor

.phpdoc-md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
return (object)[
3+
'rootNamespace' => 'vakata\certificate',
4+
'destDirectory' => 'docs',
5+
'format' => 'github',
6+
'classes' => [
7+
'\\vakata\\certificate\\BG'
8+
],
9+
];

.travis.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
language: php
2+
3+
php:
4+
- 5.4
5+
- 5.5
6+
- 5.6
7+
- 7.0
8+
9+
# This triggers builds to run on the new TravisCI infrastructure.
10+
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
11+
sudo: false
12+
13+
before_script:
14+
- travis_retry composer self-update
15+
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source
16+
17+
script:
18+
- vendor/bin/phpunit
19+
20+
after_script:
21+
- vendor/bin/test-reporter
22+
23+
addons:
24+
code_climate:
25+
repo_token:

CONTRIBUTING.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
We accept contributions via Pull Requests on [Github](https://github.com/vakata/database).
6+
7+
8+
## Pull Requests
9+
10+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
11+
12+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
13+
14+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
15+
16+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
17+
18+
- **Create feature branches** - Don't ask us to pull from your master branch.
19+
20+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
21+
22+
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
23+
24+
25+
## Running Tests
26+
27+
``` bash
28+
$ composer test
29+
```
30+
31+
32+
**Happy coding**!

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright (c) 2015 vakata <[email protected]>
4+
5+
> Permission is hereby granted, free of charge, to any person obtaining a copy
6+
> of this software and associated documentation files (the "Software"), to deal
7+
> in the Software without restriction, including without limitation the rights
8+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
> copies of the Software, and to permit persons to whom the Software is
10+
> furnished to do so, subject to the following conditions:
11+
>
12+
> The above copyright notice and this permission notice shall be included in
13+
> all copies or substantial portions of the Software.
14+
>
15+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
> THE SOFTWARE.

README.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+

composer.json

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "vakata/certificate",
3+
"description": "Parsing of digital certificates from all Bulgarian vendors",
4+
"keywords": [
5+
"vakata",
6+
"certificate"
7+
],
8+
"homepage": "https://github.com/vakata/certificate",
9+
"license": "MIT",
10+
"authors": [
11+
{
12+
"name": "vakata",
13+
"email": "[email protected]",
14+
"homepage": "http://www.vakata.com",
15+
"role": "Developer"
16+
}
17+
],
18+
"repositories": [
19+
{
20+
"type": "vcs",
21+
"url": "https://github.com/vakata/phpdoc-md"
22+
}
23+
],
24+
"require": {
25+
"php" : ">=5.4.0"
26+
},
27+
"require-dev": {
28+
"phpunit/phpunit" : "4.*",
29+
"codeclimate/php-test-reporter": "dev-master",
30+
"clean/phpdoc-md": "dev-master"
31+
},
32+
"autoload": {
33+
"psr-4": {
34+
"vakata\\certificate\\": "src"
35+
}
36+
},
37+
"autoload-dev": {
38+
"psr-4": {
39+
"vakata\\certificate\\test\\": "tests"
40+
}
41+
},
42+
"scripts": {
43+
"test": "phpunit",
44+
"psr2": "php-cs-fixer fix ./src",
45+
"phpdoc": "phpdoc-md"
46+
}
47+
}

phpunit.xml.dist

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
verbose="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false">
12+
<testsuites>
13+
<testsuite name="certificate Test Suite">
14+
<directory>tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<whitelist>
19+
<directory suffix=".php">src/</directory>
20+
</whitelist>
21+
</filter>
22+
<logging>
23+
<log type="tap" target="build/report.tap"/>
24+
<log type="junit" target="build/report.junit.xml"/>
25+
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
26+
<log type="coverage-text" target="build/coverage.txt"/>
27+
<log type="coverage-clover" target="build/logs/clover.xml"/>
28+
</logging>
29+
</phpunit>

0 commit comments

Comments
 (0)