Add organization team management methods to PHP SDK#45
Merged
Conversation
ac1768a to
0739e3e
Compare
Contributor
There was a problem hiding this comment.
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
FacturapiExceptionwith 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.
raul-facturapi
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FacturapiExceptionwith status/error payload/raw bodyVERSION.mdsemver + release notes flowVERSION.mdpull_request,pushtomain, andworkflow_dispatchTesting
./vendor/bin/phpunit --configuration phpunit.xml