Download the PHP package palanik/wrapi without Composer

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

wrapi

Wrapper for calling Restful API

wrapi allows you to call HTTP based APIs just like making calls to ordinary php functions.

Latest Stable Version Build Status License

Installation

Install with Composer

  1. Update your composer.json to require palanik/wrapi package.
  2. Run composer install to add wrapi your vendor folder.

or simply run

Easy Start

Approach I

  1. Create an array listing all the API endpoints you want to work with.
  2. Wrap endpoints with wrapi.
  3. Call individual endpoints as functions.

See Example Code

Approach II

  1. Create client object with API Base URL.
  2. Register API endpoints.
  3. Call individual endpoints as functions.

See Example Code


Endpoints Array

Declare each endpoint as per the following specifications.

eg. a small set of github.com API

Wrap endpoints

Create a API client object from wrapi. Provide the base url for the API and the endpoints array. wrapi will create a client object with all the necessary functions.

Register

Register additional API endpoints with the client object with a function name.

Make the call

Call the functions with arguments.

API

wrapi is an open ended framework and is not restricted any one or a set of public APIs. All APIs providing HTTP interface to access the endpoints can be wrapped by wrapi so that you can quickly build your client application.

Endpoint definition

method & path/url are required.

Client object

The wrapi object conveniently provides the client interface to the API. Create it by calling new wrapi\wrapi().

The constructor takes the following arguments:

  1. baseURL - The base url for the API. eg. https://api.github.com/repos/guzzle/guzzle/contributors
  2. endpoints - The array listing the endpoints of the API. Provide an empty array or a partial list and register endpoints later.
  3. options - Optional parameter. wrapi uses Guzzle module to connect to API server. The options parameter is the same options parameter used in Guzzle``request.

Register function

Add endpoints to client object.

  1. function_name - Alias for the endpoint, also the name of the function to call.
  2. endpoint_definition - Array defining the endpoint.

Function calls

Call the API via the function in the client object. Arguments to the function depend on the API declaration in the endpoints array.

Provide the arguments in the following order:

  1. named params in the url path of the endpoint. eg. $client->contributors('guzzle', 'guzzle') // guzzle (owner) & guzzle (repo) are path params
  2. querystring as an associative array with name-value pairs. eg. $client->contributors(array("since" => 364) // querystring ?since=364
  3. body - JSON content for POST or PUT methods. Skip this argument if not required.

Examples

In examples folder.

License

MIT


All versions of wrapi with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
guzzlehttp/guzzle Version >=6.1.0
sabre/uri 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 palanik/wrapi contains the following files

Loading the files please wait ....