Download the PHP package swisnl/json-api-client-laravel without Composer
On this page you can find all versions of the php package swisnl/json-api-client-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download swisnl/json-api-client-laravel
More information about swisnl/json-api-client-laravel
Files in swisnl/json-api-client-laravel
Package json-api-client-laravel
Short Description A PHP package for mapping remote JSON:API resources to Eloquent like models and collections.
License MIT
Informations about the package json-api-client-laravel
{ json:api } Client Laravel
This package contains some Laravel specific classes to make it easier to use swisnl/json-api-client with Laravel.
Installation
N.B. Make sure you have installed a PSR-18 HTTP Client and PSR-17 HTTP Factories before you install this package or install one at the same time e.g. composer require swisnl/json-api-client-laravel guzzlehttp/guzzle:^7.3
.
HTTP Client
We are decoupled from any HTTP messaging client with the help of PSR-18 HTTP Client and PSR-17 HTTP Factories.
This requires an extra package providing psr/http-client-implementation and psr/http-factory-implementation.
To use Guzzle 7, for example, simply require guzzlehttp/guzzle
:
See Bind clients if you want to use your own HTTP client or use specific configuration options.
Service Provider and Facade Aliases
The required service provider and some facade aliases are automatically discovered by Laravel.
However, if you've disabled package auto discover, you must add the service provider and optionally the facade aliases to your config/app.php
file:
Configuration
The following is the default configuration provided by this package:
If you would like to make changes to the default configuration, publish and edit the configuration file:
Getting started
Simply let the container inject the DocumentClient
and you're good to go!
Take a look at swisnl/json-api-client for more usage information.
Laravel HTTP Client
You can also use the built-in HTTP Client of Laravel if you prefer. Please note this requires Laravel 7+.
Service Provider
The \Swis\JsonApi\Client\Providers\ServiceProvider
registers the TypeMapper
, JsonApi\Parser
and both clients; Client
and DocumentClient
.
Each section can be overwritten to allow extended customization.
Bind TypeMapper
The service provider registers the \Swis\JsonApi\Client\TypeMapper
as a singleton so your entire application has the same mappings available.
Mapping types
You can manually register items with the TypeMapper
or use the supplied TypeMapperServiceProvider
:
Bind Clients
The service provider registers the Client
and DocumentClient
to your application.
By default the Client
uses php-http/discovery to find an available HTTP client, request factory and stream factory so you don't have to setup those yourself.
You can specify your own HTTP client, request factory or stream factory by customizing the container binding.
This is a perfect way to add extra options to your HTTP client or register a mock HTTP client for your tests:
N.B. This example uses our swisnl/php-http-fixture-client when in testing environment. This package allows you to easily mock requests with static fixtures. Definitely worth a try!
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
Contributing
Please see CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
SWIS :heart: Open Source
SWIS is a web agency from Leiden, the Netherlands. We love working with open source software.
All versions of json-api-client-laravel with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
swisnl/json-api-client Version ^2.0