Download the PHP package stoyantodorov/laravel-api-client without Composer

On this page you can find all versions of the php package stoyantodorov/laravel-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 laravel-api-client

Laravel HTTP Facade wrapper and Token service

This package provides a way to use Laravel HTTP facade with error handling, logging and events firing. There is also Token Service that makes requests to retrieve access token depending on stored configurations or received parameters.

Latest Version on Packagist Total Downloads

Installation

Usage

HttpClient Service

Resolve an HttpClient instance in a way that fits what you need, for example:

Send a request:

You can configure PendingRequest in advance:

You can also use baseConfig method to add base configurations:

This method can receive a configured PendingRequest:

Use send method for specific HTTP method and format:

Optionally you can add configured PendingRequest to it too:

When you need to send a request without error handling, logging and event firing may use sendRequest:

Logging and event firing is configurable trough config values:

These configurations can be overridden through HttpClient setters:

Token Service

Factories

There are two factories which instantiate TokenService. The first one sets configurations from config file:

When you are using this factory should set the relevant configurations in api-client.php:

The second factory sets configurations from data objects:

When you are using an endpoint to refresh a token, the factories should be instructed to send such configurations:

You may instruct TokenFromConfigFactory to loads configurations from other config key:

If you have an already received token, can send it to both factories as optional parameter:

Obtain a token

get method sends a token request:

If the service is instantiated with an already obtained token, the method returns it instead of sending a new request.

The same method can also send a request that refreshes the token:

The JSON path to the token in the response should be set in config file:

or in TokenData and RefreshTokenData

When you need to access the response can subscribe for the events which are fired by default:

If you aren't using these events may switch them off from the config file:

or TokenData and RefreshTokenData:

API Reference

HttpClientInterface

Enums

TokenFromConfigFactoryInterface

TokenFromDataFactoryInterface

TokenInterface

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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


All versions of laravel-api-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.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 stoyantodorov/laravel-api-client contains the following files

Loading the files please wait ....