Skip to content
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
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/box.json.dist export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/sonar-project.properties export-ignore

# Do not count these files on github code language
/tests/_files/** linguist-detectable=false
31 changes: 11 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:

# Actions
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action
# sudo-bot/action-scrutinizer@latest https://github.com/marketplace/actions/action-scrutinizer

jobs:

Expand Down Expand Up @@ -99,25 +98,14 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php-version: ['8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # required for sudo-bot/action-scrutinizer
- name: Install poppler-utils
run: |
sudo apt-get update -y -qq
sudo apt-get install -y -qq poppler-utils
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: soap, gd
coverage: xdebug
tools: composer:v2
env:
fail-fast: true
- name: Install SAT XML resources
shell: bash
run: |
Expand All @@ -129,6 +117,15 @@ jobs:
else
echo tests/_files/external-resources already exists
fi
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: soap, gd
coverage: none
tools: composer:v2
env:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
Expand All @@ -141,10 +138,4 @@ jobs:
- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist
- name: Tests (phpunit)
run: vendor/bin/phpunit --testdox --verbose --coverage-clover=build/coverage-clover.xml
- name: Upload code coverage to scrutinizer
if: ${{ !env.ACT }} # do not run if using nektos/act
uses: sudo-bot/action-scrutinizer@latest
with:
cli-args: "--format=php-clover build/coverage-clover.xml"
continue-on-error: true
run: vendor/bin/phpunit --testdox
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: '7.3' # use minimal version
php-version: '8.1' # use minimal version
extensions: soap, gd
coverage: none
tools: composer:v2
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/sonarqube-cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: "SonarQube Cloud"
on:
# secrets are not passed to workflows that are triggered by a pull request from a fork.
# see https://docs.github.com/en/actions/reference/encrypted-secrets
workflow_dispatch:
push:
branches: [ "master" ]

# Actions
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action
# SonarSource/sonarqube-scan-action@v6 https://github.com/marketplace/actions/official-sonarqube-scan

jobs:

sonarqube-cloud:
name: SonarCloud Scan and Report
runs-on: "ubuntu-latest"
steps:
- name: Check SONAR_TOKEN secret
run: |
if [ -z "${{ secrets.SONAR_TOKEN }}" ]; then
echo "::warning ::SONAR_TOKEN non set"
exit 1
fi
- name: Checkout
uses: actions/checkout@v4
- name: Unshallow clone to provide blame information
run: git fetch --unshallow
- name: Install poppler-utils
run: |
sudo apt-get update -y -qq
sudo apt-get install -y -qq poppler-utils
- name: Install SAT XML resources
shell: bash
run: |
rm -r -f tests/_files/external-resources
git clone --depth 1 https://github.com/phpcfdi/resources-sat-xml resources-sat-xml-cloned
mv resources-sat-xml-cloned/resources tests/_files/external-resources
rm -r -f resources-sat-xml-cloned
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: soap, gd
coverage: xdebug
tools: composer:v2
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist
- name: Create code coverage
run: vendor/bin/phpunit --testdox --coverage-xml=build/coverage --coverage-clover=build/coverage/clover.xml --log-junit=build/coverage/junit.xml
- name: Prepare SonarCloud Code Coverage Files
run: |
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/junit.xml > build/sonar-junit.xml
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/clover.xml > build/sonar-coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
12 changes: 6 additions & 6 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,32 @@
->setRules([
'@PSR12' => true,
'@PSR12:risky' => true,
'@PHP7x1Migration:risky' => true,
'@PHP7x3Migration' => true,
'@PHP8x1Migration' => true,
'@PHP8x0Migration:risky' => true,
// basic
'statement_indentation' => false, // invalid indentation
// symfony
'array_indentation' => true,
'class_attributes_separation' => true,
'whitespace_after_comma_in_array' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'type_declaration_spaces' => true,
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arrays', 'arguments']],
'new_with_parentheses' => true,
'no_blank_lines_after_class_opening' => true,
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['array_destructuring', 'arrays', 'match', 'arguments', 'parameters']],
'no_blank_lines_after_phpdoc' => true,
'object_operator_without_whitespace' => true,
'binary_operator_spaces' => true,
'phpdoc_scalar' => true,
'no_trailing_comma_in_singleline' => true,
'single_quote' => true,
'blank_lines_before_namespace' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_unused_imports' => true,
'yoda_style' => ['equal' => true, 'identical' => true, 'less_and_greater' => null],
'standardize_not_equals' => true,
'concat_space' => ['spacing' => 'one'],
'linebreak_after_opening_tag' => true,
'fully_qualified_strict_types' => true,
'global_namespace_import' => ['import_classes' => true],
// symfony:risky
'no_alias_functions' => true,
'self_accessor' => true,
Expand Down
23 changes: 0 additions & 23 deletions .scrutinizer.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ tools/phpcbf --colors -sp
tools/composer-normalize normalize --dry-run
tools/php-cs-fixer fix --dry-run --verbose
tools/phpcs --colors -sp
vendor/bin/phpunit --testdox --verbose --stop-on-failure
vendor/bin/phpunit --testdox --stop-on-failure
tools/phpstan analyse --no-progress
```

Expand Down
38 changes: 25 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

[![Source Code][badge-source]][source]
[![Packagist PHP Version Support][badge-php-version]][php-version]
[![Discord][badge-discord]][discord]
[![Latest Version][badge-release]][release]
[![Software License][badge-license]][license]
[![Build Status][badge-build]][build]
[![Scrutinizer][badge-quality]][quality]
[![Coverage Status][badge-coverage]][coverage]
[![Reliability][badge-reliability]][reliability]
[![Maintainability][badge-maintainability]][maintainability]
[![Code Coverage][badge-coverage]][coverage]
[![Violations][badge-violations]][violations]
[![Total Downloads][badge-downloads]][downloads]
[![Docker Downloads][badge-docker]][docker]

> Create a generic PDF file from a CFDI 3.3 & 4.0

Expand Down Expand Up @@ -116,18 +120,26 @@ and licensed for use under the MIT License (MIT). Please see [LICENSE][] for mor

[source]: https://github.com/phpcfdi/cfditopdf
[php-version]: https://packagist.org/packages/phpcfdi/cfditopdf
[discord]: https://discord.gg/aFGYXvX
[release]: https://github.com/phpcfdi/cfditopdf/releases
[license]: https://github.com/phpcfdi/cfditopdf/blob/master/LICENSE
[build]: https://github.com/phpcfdi/cfditopdf/actions/workflows/build.yml?query=branch:master
[quality]: https://scrutinizer-ci.com/g/phpcfdi/cfditopdf/
[coverage]: https://scrutinizer-ci.com/g/phpcfdi/cfditopdf/code-structure/master/code-coverage/src
[reliability]:https://sonarcloud.io/component_measures?id=phpcfdi_cfditopdf&metric=Reliability
[maintainability]: https://sonarcloud.io/component_measures?id=phpcfdi_cfditopdf&metric=Maintainability
[coverage]: https://sonarcloud.io/component_measures?id=phpcfdi_cfditopdf&metric=Coverage
[violations]: https://sonarcloud.io/project/issues?id=phpcfdi_cfditopdf&resolved=false
[downloads]: https://packagist.org/packages/phpcfdi/cfditopdf

[badge-source]: https://img.shields.io/badge/source-phpcfdi/cfditopdf-blue?style=flat-square
[badge-php-version]: https://img.shields.io/packagist/php-v/phpcfdi/cfditopdf?style=flat-square
[badge-release]: https://img.shields.io/github/release/phpcfdi/cfditopdf?style=flat-square
[badge-license]: https://img.shields.io/github/license/phpcfdi/cfditopdf?style=flat-square
[badge-build]: https://img.shields.io/github/actions/workflow/status/phpcfdi/cfditopdf/build.yml?branch=master&style=flat-square
[badge-quality]: https://img.shields.io/scrutinizer/g/phpcfdi/cfditopdf/master?style=flat-square
[badge-coverage]: https://img.shields.io/scrutinizer/coverage/g/phpcfdi/cfditopdf/master?style=flat-square
[badge-downloads]: https://img.shields.io/packagist/dt/phpcfdi/cfditopdf?style=flat-square
[docker]: https://hub.docker.com/r/phpcfdi/cfditopdf

[badge-source]: https://img.shields.io/badge/source-phpcfdi/cfditopdf-blue?logo=github
[badge-discord]: https://img.shields.io/discord/459860554090283019?logo=discord
[badge-php-version]: https://img.shields.io/packagist/php-v/phpcfdi/cfditopdf?logo=php
[badge-release]: https://img.shields.io/github/release/phpcfdi/cfditopdf?logo=git
[badge-license]: https://img.shields.io/github/license/phpcfdi/cfditopdf?logo=open-source-initiative
[badge-build]: https://img.shields.io/github/actions/workflow/status/phpcfdi/cfditopdf/build.yml?branch=master&logo=github-actions
[badge-reliability]: https://sonarcloud.io/api/project_badges/measure?project=phpcfdi_cfditopdf&metric=reliability_rating
[badge-maintainability]: https://sonarcloud.io/api/project_badges/measure?project=phpcfdi_cfditopdf&metric=sqale_rating
[badge-coverage]: https://img.shields.io/sonar/coverage/phpcfdi_cfditopdf/master?logo=sonarqubecloud&server=https%3A%2F%2Fsonarcloud.io
[badge-violations]: https://img.shields.io/sonar/violations/phpcfdi_cfditopdf/master?format=long&logo=sonarqubecloud&server=https%3A%2F%2Fsonarcloud.io
[badge-downloads]: https://img.shields.io/packagist/dt/phpcfdi/cfditopdf?logo=packagist
[badge-docker]: https://img.shields.io/docker/pulls/phpcfdi/cfditopdf?logo=docker
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"source": "https://github.com/phpcfdi/cfditopdf"
},
"require": {
"php": ">=7.3",
"eclipxe/cfdiutils": "^2.31 || ^3.0",
"php": ">=8.1",
"eclipxe/cfdiutils": "^3.0",
"league/plates": "^3.5",
"phpcfdi/cfdi-cleaner": "^1.3.3",
"spipu/html2pdf": "^5.2.8"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^10.5"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -79,7 +79,7 @@
],
"dev:test": [
"@dev:check-style",
"@php vendor/bin/phpunit --testdox --verbose --stop-on-failure",
"@php vendor/bin/phpunit --testdox --stop-on-failure",
"@php tools/phpstan analyse --no-progress"
]
},
Expand Down
19 changes: 17 additions & 2 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
# `phpcfdi/cfditopdf` Changelog

## Version 0.4.4 2024-11-08
## Version 0.5.0 2025-11-10

This version remove the compatibility with PHP 7.3, PHP 7.4 and PHP 8.0.
PHP minimal version is 8.1.
PHPUnit now runs using version 10.5.

In the generic template, the variables `$pagos` & `$pago` has been renamed to `$pagos10` & `$pago10`.

Other changes:

- Code cleaning: Thanks to *PHPStan*, *rector/rector* and *PHPStorm*.
- Removed Scrutinizer-CI integration. Thanks for everything.
- Add SonarQube Cloud integration.
- Use common PhpCfdi badges and code standards.

## Version 0.4.4 2025-11-08

- Add Docker Hub public image. Thanks to `@dreglad` for the inspiration.

## Version 0.4.3 2024-11-08
## Version 0.4.3 2025-11-08

- Fix compatibility with PHP 8.4.
- Allow dependence of `eclipxe/cfdiutils` to match versions `^2.31` and `^3.0`.
Expand Down
12 changes: 7 additions & 5 deletions docs/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ Intro: Al completar una tarea pasarla de *Planeada* a *Finalizada*. Escribir fec

## Planeadas

- Revisar que <https://github.com/spipu/html2pdf/issues/530> esté solucionado para desactivar "permitir fallos"
en PHP 7.4 porque `spipu/html2pdf` tiene un bug.
- Cambiar a PHP 7.2 o mayor.
- Al cambiar de versión de PHP, actualizar los métodos que retornan void a que explícitamente lo hangan.
- Modificar `NodeInterface<NodeInterface>` para cuando `eclipxe/cfdiutils` ya lo incluya por sí mismo.
- Catálogos para expresar las claves.
- Impresión genérica de complementos.
- Crear nuevos métodos para generar el archivo PDF.

## Finalizadas

### En versión 0.5.0

- Se elimina la compatibilidad con PHP 7.3, PHP 7.4 y PHP 8.0.
- Al cambiar de versión de PHP, actualizar los métodos que retornan void a que explícitamente lo hangan.
- El fallo que se presentaba en [`spipu/html2pdf`](https://github.com/spipu/html2pdf/issues/530) ya no existe.
- Modificar `NodeInterface<NodeInterface>` para cuando `eclipxe/cfdiutils` ya lo incluya por sí mismo.

### En versión 0.3.2 o anteriores

- Otros nodos de los conceptos.
Expand Down
23 changes: 14 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="./tests/bootstrap.php"
cacheResultFile="./build/phpunit.result.cache"
colors="true">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
cacheDirectory="build/phpunit"
bootstrap="tests/bootstrap.php"
executionOrder="depends,defects"
displayDetailsOnAllIssues="true"
colors="true"
>

<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>

<source>
<include>
<directory suffix=".php">src</directory>
<directory>src</directory>
</include>
</coverage>
</source>
</phpunit>
Loading