Download the PHP package dogado/json-api-client without Composer

On this page you can find all versions of the php package dogado/json-api-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package json-api-client

Abstract client side php implementation of the JSON:API protocol.

phpunit Coverage Status Total Downloads Latest Stable Version Latest Unstable Version License

Installation

It's recommended to install guzzlehttp/guzzle version ^7.0 as http-client and http-interop/http-factory-guzzle for PSR-17 compatible factories.

You can also use any other HTTP client which implements PSR-18.

Usage

First you should read the docs of dogado/json-api-common where all basic structures will be explained.

Your API client is an instance of Dogado\JsonApi\Client\JsonApiClient, which requires a PSR-18 HTTP client (Psr\Http\Client\ClientInterface) to execute requests.

Action Pattern

In most cases it's easier to capsule request scenarios into single classes since every request has its own requirements. In this package this is called Action. To make things easier, we already defined an AbstractAction class under the Dogado\JsonApi\Client\Action namespace. An example how to create such an action can be found in the tests.

When fetching resources in actions it's also very common to filter, paginate and sort. To define these options within Actions, there are multiple Traits you can use, defined in the same namespace as the AbstractAction class.

Authentication

When using a JSON:API client to access a server application you will probably need to be authenticated. As this a common use case, this client offers native support for authentication as so called "AuthenticationMiddleware" represented by an interface. The client provides a native set of authentication mechanisms: OAuth2 client credentials and HTTP basic auth, but you can create a custom middleware yourself based on the AuthenticationMiddlewareInterface if that doesn't fit your needs or feel free to create a pull request to add more authentications.

OAuth2

The AuthenticationMiddleware class requires a Dogado\JsonApi\Client\Model\OAuth2Credentials instance which contains an access token, the token type and the expiration date. You can either create an instance yourself and insert the required data or use the Dogado\JsonApi\Client\Service\OAuth2Authenticator class to generate them.

Please cache the OAuth2Credentials instance as long as the method isExpired is not true, to prevent unnecessary authentication calls.

As the authentication endpoint does not follow the JSON:API protocol, it also throws no JSON:API specific errors or exceptions. The only relevant errors are variations of the Dogado\JsonApi\Client\Exception\Oauth2\AuthenticationException class which differentiates between error message and code. Such an exception instance also contains the plain response as Psr\Http\Message\ResponseInterface to have more context to an error.

Credits

This package contains code taken from enm/json-api-client.

License

The MIT License (MIT). Please see License File for more information.


All versions of json-api-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-json Version *
dogado/json-api-common Version ^3.0
psr/http-factory Version ^1.0
psr/http-client Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dogado/json-api-client contains the following files

Loading the files please wait ....