Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Json Api Client

Json Api Client Laravel Package

enm/json-api-client

Abstract client-side PHP implementation of the JSON:API specification. Build requests with JsonApiClient using any PSR-18 HTTP client, execute them, and deserialize responses into documents and included resources via the bundled serializer and deserializer.

View on GitHub
Deep Wiki
Context7

Abstract client-side php implementation of the json api specification (jsonapi.org)

Frequently asked questions about Json Api Client
How do I install enm/json-api-client in a Laravel application?
Install it with composer require enm/json-api-client. The README also recommends PSR-7/PSR-17 factories and a PSR-18 HTTP client, so add a maintained implementation such as nyholm/psr7 and a modern PSR-18 client; the README's kriswallsmith/buzz suggestion is outdated. There is no Laravel package discovery or service provider, so you must wire the client yourself. Verify the PHP constraint before installing.
Does enm/json-api-client work with Laravel's HTTP client?
No, Laravel's HTTP client does not implement PSR-18's ClientInterface, which the JsonApiClient constructor requires. You need a PSR-18 client or a bridge/adapter around Laravel's HTTP client. The recommended approach is to keep the package behind an application-owned interface so your controllers and jobs do not depend on it directly.
Is enm/json-api-client a Laravel package with a service provider?
No. It is a framework-agnostic client-side JSON:API abstraction with no service provider, config file, facade or Eloquent integration. You register it yourself in a service provider as a singleton, passing the base URI, PSR-18 client, URI factory, request factory, stream factory, serializer and deserializer. All Laravel wiring is your responsibility.
Which PHP and Laravel versions does enm/json-api-client support?
The package was last released in 2019 and is archived, so its Composer constraints likely predate PHP 8.x and current PSR interface versions. You must check the PHP constraint, the enm/json-api-common dependency and the PSR-7/17/18 versions against your Laravel runtime. Expect to fork or upgrade dependencies, and do not assume any specific Laravel version support.
How do I deserialize a JSON:API response into documents and included resources?
Create a request with createGetRequest, execute it through the client, then call document() on the response. Use data()->first() to get the primary resource and included()->all() to get included resources. The bundled Deserializer converts the JSON:API payload into document objects; test edge cases such as empty relationships, compound documents and error responses against your real API.
Does enm/json-api-client support includes, sparse fieldsets, pagination, filtering and sorting?
Includes are supported directly through requestInclude on the request object. The library is an abstract implementation of the JSON:API specification, but you must confirm which request-building helpers exist for sparse fieldsets, pagination, filtering and sorting in the enm/json-api-common docs. Also verify whether your target API uses JSON:API 1.0 or 1.1 features such as atomic operations, and validate relationship writes and error documents separately.
Is enm/json-api-client still maintained and safe for production?
It is archived, was last released in 2019, has negligible adoption and zero dependents, and has no active upstream support. Production use means owning a fork, dependency upgrades, security patching and compatibility testing. The MIT license permits forking, but that creates ongoing engineering ownership. For a small integration, a thin in-house client around Laravel's HTTP client may be cheaper.
What are alternatives to enm/json-api-client for consuming a JSON:API API?
You can implement a minimal client around Laravel's HTTP client with your own JSON:API document structures, which avoids an abandoned dependency. Alternatively, look for an actively maintained JSON:API client on Packagist and check its PHP and PSR-18 support. Because this package is archived, treat it as a reference implementation or spike, and run contract tests against your API before choosing.
How do I handle JSON:API error documents and HTTP failures with this client?
Transport errors surface as PSR-18 client exceptions, while HTTP error responses must be inspected and their JSON:API error documents deserialized by your adapter. The bundled deserializer handles documents, but you should explicitly map error objects and non-2xx statuses in application code. Timeouts, retries and rate limits are not handled by the library, so add them in the PSR-18 client or Laravel jobs.
How do I test a Laravel integration with enm/json-api-client?
There is no Laravel integration to test directly, so put the client behind an application-owned interface such as JsonApiGateway and test that adapter with a fake PSR-18 client returning canned JSON:API responses. Add contract tests against a real or mocked API covering includes, sparse fieldsets, pagination links, empty relationships and error documents. If you fork the package, also add compatibility tests for your PHP and PSR versions.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect