Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #3

Merged
merged 17 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"version": 2,
"updates": [
{
"allow": [
{
"dependency-type": "all"
}
],
"directory": "/",
"package-ecosystem": "composer",
"schedule": {
"interval": "daily"
},
"versioning-strategy": "increase"
},
{
"directory": "/",
"package-ecosystem": "github-actions",
"schedule": {
"interval": "daily"
}
}
]
}
32 changes: 32 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Continuous Integration"

on:
pull_request:
push:
branches:
- 'refs/pull/*'
- 'main'

jobs:
matrix:
name: Generate job matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Gather CI configuration
id: matrix
uses: laminas/laminas-ci-matrix-action@v1

qa:
name: QA Checks
needs: [matrix]
runs-on: ${{ matrix.operatingSystem }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
steps:
- name: ${{ matrix.name }}
uses: laminas/laminas-continuous-integration-action@v1
with:
job: ${{ matrix.job }}
7 changes: 4 additions & 3 deletions .github/workflows/cs.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Code Style

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
push:
branches:
- 'refs/pull/*'
- 'main'

jobs:
build:
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: PHPStan
on:
pull_request:
push:
branches:
- 'refs/pull/*'
- '5.x'

env:
CI: true

jobs:
run:
name: PHPStan ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
php: [ '8.2' ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: ${{ matrix.php }}
ini-values: memory_limit=-1
tools: composer:v2

- name: Determine composer cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ matrix.php }}-composer-

- name: Install Dependencies
run: composer update --no-progress --ansi

- name: PHPStan
run: ./vendor/bin/phpstan analyse
39 changes: 0 additions & 39 deletions .github/workflows/tests.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
vendor
.idea
.DS_Store
/zugferd10
/composer.lock
/zugferd20
/zugferd211de
.phpunit.result.cache
Expand Down
7 changes: 7 additions & 0 deletions .laminas-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"exclude": [
{
"name": "README Linting [8.0, latest]"
}
]
}
69 changes: 43 additions & 26 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,52 @@
<?php

declare(strict_types=1);

$finder = (new PhpCsFixer\Finder())
->in([__DIR__ . '/src', __DIR__ . '/tests']);
/*
* This file is part of the ZUGFeRD PHP package.
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

return (new PhpCsFixer\Config())
->setRiskyAllowed(false)
use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$header = <<<'EOF'
This file is part of the ZUGFeRD PHP package.

This source file is subject to the MIT license that is bundled
with this source code in the file LICENSE.
EOF;

$finder = (new Finder())
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->append([
__FILE__,
])
;

return (new Config())
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'@PhpCsFixer' => true,
'@Symfony:risky' => true,
'@DoctrineAnnotation' => true,
'array_syntax' => ['syntax' => 'short'],
'cast_spaces' => ['space' => 'none'],
'phpdoc_summary' => false,
'no_superfluous_phpdoc_tags' => true,
'header_comment' => ['header' => $header],
'concat_space' => ['spacing' => 'one'],
'yoda_style' => false,
'ordered_class_elements' => false,
'ordered_imports' => false,
//'method_argument_space' => null,
//'no_whitespace_in_blank_line' => null,
//'no_extra_blank_lines' => null,
//'braces' => null,
'blank_line_before_statement' => false,
'phpdoc_align' => ['align' => 'left'],
'phpdoc_var_without_name' => false,
'phpdoc_types_order' => false,
'phpdoc_order' => false,
'phpdoc_separation' => false,
//'no_superfluous_elseif' => null,
'class_definition' => false,
'ternary_to_null_coalescing' => true,
'php_unit_test_class_requires_covers' => false,
'php_unit_internal_class' => false,
'native_constant_invocation' => true,
'native_function_invocation' => ['include' => ['@compiler_optimized']],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'global_namespace_import' => ['import_functions' => true],
'declare_strict_types' => true,
'non_printable_character' => false,
'no_trailing_whitespace_in_string' => false,
])
->setFinder($finder);
->setFinder($finder)
;
31 changes: 4 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,21 @@ ZUGFeRD PHP SDK (Factur-X, XRechnung) - Convert PHP Objects to XML and back.
[Look @ Tests for more details](tests)

## Installation
The recommended way of installing this library is using [Composer](http://getcomposer.org/).

The recommended way of installing this library is using [Composer](http://getcomposer.org/).

Add this repository to your composer information using the following command

```bash
composer require easybill/zugferd-php
```

## Usage ZUGFeRD v1

Convert XML to PHP Objects:

```php
use Easybill\ZUGFeRD\Reader;

$document = Reader::create()->getDocument('zugferd-file.xml');
echo $document->getHeader()->getId(); // Get invoice No.
```

Convert PHP Objects to XML:

```php
use Easybill\ZUGFeRD\Builder;
use Easybill\ZUGFeRD\Model\Document;

$doc = new Document(Document::TYPE_COMFORT);
$doc->getHeader()->setId('RE1337'); // Set invoice No.

$xml = Builder::create()->getXML($doc);
echo $xml; // Zugferd XML.
```

## Usage ZUGFeRD v2.1

Convert XML to PHP Objects:

```php
use Easybill\ZUGFeRD211\Reader;
use src\Reader;

$xml = file_get_contents('factur-x.xml');
$obj = Reader::create()->transform($xml);
Expand All @@ -54,7 +31,7 @@ $obj = Reader::create()->transform($xml);
Convert PHP Objects to XML:

```php
use Easybill\ZUGFeRD211\Builder;
use src\Builder;

$obj = ...;

Expand Down
22 changes: 13 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "easybill/zugferd-php",
"name": "silarhi/zugferd-php",
"description": "ZUGFeRD PHP SDK (Factur-X, XRechnung) - Convert PHP Objects to XML and back.",
"keywords": [
"ZUGFeRD", "Factur-X", "XRechnung"
Expand All @@ -11,31 +11,35 @@
{
"name": "Patrick Romowicz",
"email": "[email protected]"
},
{
"name": "SILARHI",
"email": "[email protected]"
}
],
"require": {
"php": "^7.4 || ^8.0",
"jms/serializer": "^3.16",
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"jms/serializer": "^3.18",
"ext-dom": "*"
},
"suggest": {
"ext-libxml": "Needed for XSD validation"
},
"require-dev": {
"phpunit/phpunit": "^9.3",
"phpunit/phpunit": "^9.6.15",
"ext-libxml": "*",
"friendsofphp/php-cs-fixer": "^3.16"
"friendsofphp/php-cs-fixer": "^3.16",
"phpstan/phpstan": "^1.10",
"rector/rector": "^1.0"
},
"autoload": {
"psr-4": {
"Easybill\\ZUGFeRD\\": "src/zugferd10",
"Easybill\\ZUGFeRD211\\": "src/zugferd211"
"Easybill\\ZUGFeRD\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Easybill\\ZUGFeRD\\": "tests/zugferd10",
"Easybill\\ZUGFeRD211\\": "tests/zugferd211"
"Easybill\\ZUGFeRD\\Tests\\": "tests/"
}
},
"config": {
Expand Down
Loading
Loading