Files
business-data-fetcher/.gitignore
Ismo Vuorinen 150c466368 feat!: migrate to Valinor DTOs, add v3 YTJ API client, modernize tooling (#13)
* feat!: moved v1 api under src/v1

BREAKING CHANGE: please update your namespaces if you use any
of the classes directly or composer doesn't like the namespace
change.

* feat!: migrate from spatie/dto to valinor, add pest and rector

BREAKING CHANGE: replaced spatie/data-transfer-object with cuyz/valinor,
upgraded phpcs to v4, added pestphp/pest and rector/rector.
Removed ivuorinen/markdowndocs due to symfony/console conflict.

* feat: add shared HTTP AbstractClient with Valinor mapper

Base class providing Guzzle HTTP client and Valinor TreeMapper
with allowSuperfluousKeys() for PRH API response hydration.

* refactor!: migrate v1 DTOs to final readonly with Valinor hydration

BREAKING CHANGE: all v1 DTOs are now final readonly classes with
constructor promotion. Traits are method-only (properties removed).
HasVersion trait deleted. BusinessDataFetcher extends AbstractClient.

* feat: add v3 YTJ API client with DTOs

New client for PRH opendata-ytj-api v3 with full DTO coverage
matching the v3 OpenAPI schema.

* test: add Pest test suite for v1 and v3

Unit tests for all v1 DTOs, traits, and BusinessDataFetcher client.
Unit tests for v3 Client and Company DTO hydration.
Includes JSON fixtures for realistic response testing.

* chore: add Rector config with deadCode, codeQuality, typeDeclarations

* ci: update workflows to use ivuorinen/actions, pin SHAs, add PHP 8.4

Migrated from ivuorinen/.github reusable workflows to
ivuorinen/actions composite actions with pinned commit SHAs.
Added PHP 8.4 to test matrix. Updated renovate config preset path.
Added labels.yml for sync-labels workflow.

* chore: clean up .gitignore for PHP-only project

Removed irrelevant entries for Node.js, Next.js, Nuxt, Laravel,
Vagrant, Android/Crashlytics, CMake, and other unused ecosystems.

* docs: update README, add CHANGELOG, CONTRIBUTING, and CLAUDE.md

Rewrote README with v1/v3 usage examples and badges.
Added CHANGELOG, CONTRIBUTING guide, and CLAUDE.md project instructions.
Added .claude/ settings for Claude Code integration.

* chore(deps): update composer.lock

* chore: add CaptainHook with conventional commits and secrets detection

Added captainhook/captainhook, captainhook/hook-installer,
captainhook/secrets, and ramsey/conventional-commits.

Hooks configured:
- pre-commit: secrets check, lint-fix, test
- commit-msg: conventional commit validation
- post-change: composer install on lock/json changes

* fix(deps): regenerate composer.lock with PHP 8.2 compatibility

Downgraded symfony packages from v8 to v7.4 to support the
full PHP 8.2/8.3/8.4 test matrix.

* fix: address PR #13 code review feedback

- Pin captainhook versions (^5.0, ^1.0) instead of wildcard
- Add ext-json to composer.json require block
- Fix v3 Client base URI to avoid duplicate path prefix
- Handle null language in HasLanguage trait
- Remove empty-string defaults from structural DTO fields
- Remove branch-specific section from CLAUDE.md
- Fix vendor path deny pattern in .claude/settings.json
- Use phpcbf directly in post-edit lint hook
- Add null register test case
- Cast json_encode in ClientTest for type safety

* chore(deps): regenerate composer.lock with PHP 8.2

* fix: address PR #13 code review feedback (round 2)

- Downgrade stale.yml permissions from contents:write to contents:read
- Remove nullable arrays in BisCompanyDetails (PRH API always returns arrays)
- Mark 3 additional breaking changes in CHANGELOG.md
- Extract API_PREFIX constant in v3 Client to reduce path duplication

* fix(ci): resolve merge conflict markers in composer workflow

* fix(ci): clean up pr-lint workflow

* chore: add MegaLinter configuration

* docs: add PHPDoc to HTTP layer classes

* docs: add PHPDoc to v1 DTOs, traits, and exceptions

* docs: add PHPDoc to v3 DTOs and exceptions

* fix(ci): use Composer download cache instead of vendor cache

Caching vendor/ can inject stale binaries that pass unexpected
arguments (e.g. --cache-directory) to Pest. Switch to caching
~/.composer/cache which only stores download archives.

* fix(ci): add permissions to PR lint job

MegaLinter needs write access to issues, pull-requests, and statuses
to post results. Add explicit permissions block to the lint job.

* fix: add source directory to phpcs.xml

MegaLinter runs phpcs in project mode which relies on phpcs.xml to
know which directories to scan. Add <file>src</file> so it finds code.

* fix(deps): add SARIF and phpstan extension-installer packages

Add phpstan/extension-installer, jbelien/phpstan-sarif-formatter, and
bartlett/sarif-php-converters so MegaLinter can produce SARIF output
from phpstan.

* fix(ci): disable JSON_PRETTIER and configure markdownlint

- Disable JSON_PRETTIER linter in MegaLinter (not needed)
- Add .markdownlint.json disabling MD041 (first-line-heading false
  positive on YAML frontmatter)
- Wrap bare URLs in README.md with angle brackets (MD034)

* fix: add phpunit.xml.dist with cacheDirectory

Prevents Pest's Cache plugin from injecting --cache-directory argument
in CI, which caused PHPUnit to misparse it as a config file.

* fix(ci): fix MegaLinter config

Remove JSON_PRETTIER and PHP_PHPSTAN from ENABLE_LINTERS to resolve
conflicts with DISABLE_LINTERS and missing SARIF extension. Add .claude/
to FILTER_REGEX_EXCLUDE.

* fix: resolve markdownlint errors

Disable MD013 (line length), add blank lines around headings/lists in
CHANGELOG.md, fix table separator spacing in README.md.

* fix: harden v3 Client error handling and URL encoding

- Make BusinessLine::$code required (no empty-string default)
- URL-encode businessId in v1 client to prevent path injection
- Catch \JsonException alongside RequestException in v3 Client
  searchCompanies() and getPostCodes() since getJson() can throw it

* fix: pin dependency versions and enable workflow YAML linting

- Pin phpstan/extension-installer, jbelien/phpstan-sarif-formatter,
  and bartlett/sarif-php-converters to ^1.0 instead of wildcard
- Remove .github/ from MegaLinter FILTER_REGEX_EXCLUDE so YAML
  linters can check workflow files

* fix: resolve yamllint errors in GitHub YAML files

- Add missing document start marker to labels.yml
- Fix step indentation in composer.yml workflow

* fix: resolve markdownlint errors and disable YAML_PRETTIER

* chore: add yamllint configuration
2026-03-07 13:28:39 +02:00

64 lines
892 B
Plaintext

# PHP / Composer
composer.phar
/vendor/
# PHP CS Fixer
.php-cs-fixer.cache
.php-cs-fixer.php
# PHPUnit / Pest
.phpunit.result.cache
.phpunit.cache
/phpunit.xml
# Build artifacts
/build/
# Logs
*.log
# Environment
.env
.env*.local
# OS / Editor
.DS_Store
[._]*.s[a-v][a-z]
!*.svg
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
*~
[._]*.un~
# Vim
Session.vim
Sessionx.vim
.netrwhist
tags
# JetBrains (PHPStorm)
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
.idea/**/libraries
*.iws
.idea_modules/
.idea/replstate.xml
.idea/sonarlint/
.idea/httpRequests
.idea/caches/build_file_checksums.ser
# Claude Code
.claude/settings.local.json