Skip to content

Commit 3f0d61c

Browse files
committed
ubl scratch
0 parents  commit 3f0d61c

File tree

4 files changed

+86
-0
lines changed

4 files changed

+86
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.idea/
2+
/build/
3+
/vendor/
4+
/composer.lock
5+
.DS_Store
6+
.php_cs.cache

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Giancarlos Salas
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 all
13+
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 THE
21+
SOFTWARE.

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# UBL Schema Validator
2+
3+
[![Travis-CI](https://img.shields.io/travis/giansalex/ubl-validator.svg?branch=master&style=flat-square)](https://travis-ci.org/giansalex/ubl-validator)
4+
[![Coverage Status](https://img.shields.io/coveralls/giansalex/ubl-validator.svg?label=coverage&style=flat-square&branch=master)](https://coveralls.io/github/giansalex/ubl-validator?branch=master)
5+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c911fe005e73428591aa13b966bc488a)](https://www.codacy.com/app/giansalex/ubl-validator?utm_source=github.com&utm_medium=referral&utm_content=giansalex/ubl-validator&utm_campaign=Badge_Grade)
6+
OASIS Universal Business Language Schema Validator, SUNAT - Perú.
7+
8+
## Install
9+
Via Composer from [packagist.org](https://packagist.org/packages/greenter/ubl-validator).
10+
```bash
11+
composer require greenter/ubl-validator
12+
```
13+
14+
## Example
15+
```php
16+
use Greenter\Ubl\Resolver\UblVersionResolver;
17+
use Greenter\Ubl\SchemaValidator;
18+
19+
$xmlPath = '20000000001-01-F001-1.xml';
20+
$xml = file_get_contents($xmlPath);
21+
22+
$validator = new SchemaValidator();
23+
$resolver = new UblVersionResolver()
24+
$validator->setVersion($resolver->getVersion($xml));
25+
26+
$result = $validator->validate($xml);
27+
28+
if ($result) {
29+
echo 'Validación exitosa';
30+
} else {
31+
echo $validator->getMessage();
32+
}
33+
34+
35+
```

composer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "greenter/ubl-cli",
3+
"description": "UBL v2.0, UBL v2.1 Validator",
4+
"keywords": ["ubl", "validator", "greenter", "facturacion electronica", "phar"],
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Giancarlos Salas",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"homepage": "https://github.com/giansalex/ubl-validator-cli",
13+
"type": "project",
14+
"require": {
15+
"php": "^7.1",
16+
"greenter/ubl-validator": "^1.1",
17+
"symfony/console": "^4.1"
18+
},
19+
"autoload": {
20+
"psr-4": {
21+
"App\\": "src/"
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)