Download the PHP package thomas-squall/php-easy-api without Composer

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

API System for PHP Tweet

Easy to use library which takes advantage of the PHP7 annotations library.

Installation

Using composer is quite simple, just run the following command:

Before starting

Please remember that in order to work you should make sure that every endpoint you call the resolver snippet should be called too. I've attached an htaccess-example that could help. If you got any doubt please open an issue here.

Usage Example

Client

Let's assume we've got the following class:

This is a basic implementation to call the lists/ mailchimp endpoint.

PS: Note that {$dataCenter}, {$username} and {$password} special strings are used. This special strings will evaluate with the class corresponding field value.

Now if we want to proceed and make the call we just need to do:

Let's analyze: 1) We instantiated a Mailchimp object. 2) We filled the needed values for the call. 3) We instantiated a \PHPEasyAPI\Resolver object. 4) We called the makeRequest method of the resolver passing the Mailchimp object (which is a API Client as per annotations) and the name of the field containing the Endpoint annotation. 5) We printed the value of the field containing the endpoint of the annotation.

PS: Note that the result will be put inside the field itself.

Server

Let's assume we've got the following class:

And we want to listen for incoming calls at the getList method of the user. To do that we need to bind the listener to an endpoint in that way:

NB: The base url is needed to make the resolver understand which part of the request url do not compute. Not setting it will throw an Exception as it is crucial for the system to work.

Now what remains to do is to resolve incoming requests:

Let's analyze: 1) We created a Listener class. 2) We annotated the class with the \PHPEasyAPI\Server annotation. 3) We created a method to handle calls and annotated with the \PHPEasyAPI\Enrichment\Endpoint annotation. 4) In the Endpoint annotation we passed the method (GET in this case) we wanted to handle and the url structure (Note that :userId ans :listId are placeholder and they will be substituted with the corresponding part of the url and passed to the function as parameters on the given order). 5) We bound the 'user' endpoint to an instance of the Listener. 6) We resolved the requested url.


All versions of php-easy-api with dependencies

PHP Build Version
Package Version
Requires thomas-squall/php-magic-annotations Version ^0.9.6
curl/curl Version ^2.2
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 thomas-squall/php-easy-api contains the following files

Loading the files please wait ....