Download the PHP package lessmore92/api-consumer without Composer

On this page you can find all versions of the php package lessmore92/api-consumer. 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 api-consumer

api-consumer

Build REST API consumer (client) easier than ever

Installing

Easily install it through Composer:

Support

Usage

Easily extends your class from and impalements method, and builds your awesome API Client.

Example:

Below is the minimum requirement to start building API client: ConfigApi

If the api key needs to be placed in the query string use setQueryApiKey instead of setHeaderApiKey for example $api->setQueryApiKey('API-TOKEN','TOKEN');


The Magic of $this->Request()

By inheriting your class will be able to utilize method, which supports chaining. With you will be able to access all the features and functionalities to make your request.

Define your first method to receive data from api: Simple GET Request

To specify an endpoint to be called, you must use ->Endpoint() method. After that by chaining ->Get() method at the end, REQUEST METHOD is specified as GET.

In the above example we defined a method to GET Users list from server.

By calling Users() method, in fact we are getting https://MY-API-BASE-URL.COM/users


Make another request: Add Query String

To pass data in query string (e.g to search, order or filter) you can use ->AddQueryString() method.

In the above example we defined a method to search in users.

By calling SearchUsers('alex') method, in fact we are getting https://MY-API-BASE-URL.COM/users?search=alex


Make another request: Get result in json format

To receive data as json, you must use ->AcceptJson() method.

As you can see in the code above, by chaining ->AcceptJson() in request we are telling to api server that we accept json, then in the return line we are returning a json formatted search result.

For json data format, your api server must be able to provide json formatted response and support HEADER 'accept : application/json'


All versions of api-consumer with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
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 lessmore92/api-consumer contains the following files

Loading the files please wait ....