Skip to content

Add organization team management methods to PHP SDK#45

Merged
javorosas merged 7 commits intomainfrom
v4-cleanup-modernization
Mar 31, 2026
Merged

Add organization team management methods to PHP SDK#45
javorosas merged 7 commits intomainfrom
v4-cleanup-modernization

Conversation

@javorosas
Copy link
Copy Markdown
Member

@javorosas javorosas commented Mar 31, 2026

Summary

  • add organization team management methods to the PHP SDK (access, invites, and team roles)
  • modernize SDK v4 internals and runtime behavior:
    • PSR-18 HTTP layer (Guzzle-backed default)
    • richer FacturapiException with status/error payload/raw body
    • consistent non-2xx handling across request methods
  • keep compatibility and migration clarity:
    • snake_case and legacy aliases deprecations where applicable
    • Composer and non-Composer loading paths documented
  • update docs and release automation:
    • VERSION.md semver + release notes flow
    • deploy workflow aligned to VERSION.md
  • add/expand PHPUnit coverage across critical paths and edge cases
  • add CI workflow for pull_request, push to main, and workflow_dispatch

Testing

  • ./vendor/bin/phpunit --configuration phpunit.xml

@javorosas javorosas force-pushed the v4-cleanup-modernization branch from ac1768a to 0739e3e Compare March 31, 2026 09:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the PHP SDK’s Organizations resource with team management endpoints (access, invites, roles), while also modernizing the SDK for a v4 release (new HTTP stack + exceptions, PHP version bump, autoloading, docs, and CI) to support the new surface area consistently across the client.

Changes:

  • Added Organizations team management methods (team access, invites, and team roles APIs) with unit tests.
  • Reworked the HTTP layer to PSR-18 (Guzzle-backed by default), added FacturapiException with richer error data, and updated resources to typed endpoints + camelCase methods with snake_case deprecations.
  • Updated packaging/docs/tooling: PHP >=8.2, PSR-4 autoloading, PHPUnit 11 config, CI workflow, and version/release notes handling.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
VERSION.md New v4 release notes (breaking changes + migration notes).
VERSION Removed legacy release-notes file (replaced by VERSION.md).
composer.json Bumps PHP requirement, adds Guzzle/PSR-18 deps, switches to PSR-4 autoload, updates dev deps.
src/Http/BaseClient.php Replaces cURL with PSR-18 request execution, adds config normalization, error decoding, multipart support.
src/Exceptions/FacturapiException.php New richer exception type exposing status/error payload/raw body.
src/Exceptions/Facturapi_Exception.php Backward-compatible alias to FacturapiException.
src/Facturapi.php Updates client construction to pass config; adds ComercioExteriorCatalogs; keeps non-Composer require_once path.
src/Resources/Organizations.php Adds team management methods + updates existing endpoints to new HTTP helpers and conventions.
src/Resources/Webhooks.php Updates to new HTTP helpers; adds local-first webhook signature verification with API fallback.
src/Resources/Invoices.php Converts methods to camelCase with deprecated snake_case aliases; uses new HTTP helpers.
src/Resources/Receipts.php Converts methods to camelCase with deprecated snake_case aliases; uses new HTTP helpers.
src/Resources/Retentions.php Converts methods to camelCase with deprecated snake_case aliases; uses new HTTP helpers.
src/Resources/Customers.php Updates resource to new HTTP helpers and typed endpoint property.
src/Resources/Products.php Updates resource to new HTTP helpers and typed endpoint property.
src/Resources/Tools.php Updates resource to new HTTP helpers and query handling.
src/Resources/Catalogs.php Updates resource to new HTTP helpers and query handling.
src/Resources/CartaPorteCatalogs.php Updates resource to new HTTP helpers and query handling.
src/Resources/ComercioExteriorCatalogs.php Updates resource to new HTTP helpers and query handling.
tests/bootstrap.php PHPUnit bootstrap wiring (autoload + test support loading).
tests/Support/FakeHttpClient.php PSR-18 fake client for request capture + queued responses.
tests/Resources/OrganizationsTeamManagementTest.php Coverage for new Organizations team access/invites/roles endpoints.
tests/Resources/OrganizationsMultipartTest.php Verifies multipart request construction + upload error handling.
tests/Resources/OrganizationsDomainTest.php Coverage for domain-check endpoint + deprecated signature path.
tests/Resources/WebhooksTest.php Tests local-first webhook signature verification + API fallback.
tests/Resources/InvoicesTest.php Verifies request headers/paths + last-status behavior.
tests/Resources/InvoiceReceiptCreationTest.php Verifies JSON bodies/query serialization + error shape preservation.
tests/Http/ErrorHandlingTest.php Ensures JSON error shapes are surfaced on FacturapiException.
tests/Http/ErrorHandlingNonJsonEdgeCasesTest.php Ensures raw-body errors are surfaced for non/invalid JSON.
phpunit.xml Adds PHPUnit config (bootstrap, cache, suite).
.github/workflows/ci.yml Adds CI matrix for running PHPUnit via Composer install.
.github/workflows/deploy-on-main.yml Updates release automation to read VERSION.md (instead of VERSION).
README.md Updated English docs for v4 usage/config/error-handling.
README.es.md Added Spanish docs mirroring v4 guidance.
example.php Updates example to use Composer autoload + env var API key.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@javorosas javorosas merged commit fa3d830 into main Mar 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants