Download the PHP package perfumer/microservices without Composer

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

What is it

This is library to request Perfumerlabs microservices. Currently following microservices are supported:

All classes are autogenerated based on annotations.

Fast example

HTTP transactions

Library supports HTTP transactions. Mechanism is very simple. You connect storage provider. Then write transaction, and after commit method all http-requests in transaction are stored to that storage.

If a request is failed, then its data is persisted in the storage. Then you can retry requests in the daemon or cron job.

Transaction example:

Example of daemon worker to resend requests we use:

Request debugging

If _debug=true is provided to Request class, then Microservice during requesting sets debug=true option to Guzzle client. If it is enabled Guzzle prints some information about request to stdout.

Request catching

Library supports also any request catching servers for more convenient debugging. Request catching servers print requests as-is when they come. There are many free online request catching services in the google search.

Any microservice class allows request_catcher_host parameter in constructor options. If it is defined, and _catch=true provided to Request class, then microservice class also sends special request to that host. The request contains full request and response details in the body.

How to write annotations for HTTP methods

Say, we have a Crm service and want to generate annotation for GET /user request. We open src/Contract/Crm.php and add class annotation like this:

To execute generation launch php generate.php. This annotation after generation creates a number of things:

  1. Base request class at generated/src/Crm/Request/User/GetUserRequest.php
  2. Empty request class at src/Crm/Request/User/GetUserRequest.php
  3. Base response class at generated/src/Crm/Response/User/GetUserResponse.php
  4. Empty response class at src/Crm/Response/User/GetUserResponse.php
  5. Base class at generated/src/Crm/Crm.php and/or method getUser in the class
  6. Empty class at src/Crm/Crm.php if this is missing.

As you notice, request class path is generated by the next scheme:

Same as Response class:

Where microservice, model, action and submodule are annotation properties. Also there are parameters to set:

For convenience, there a number of predefined annotations, which set some of parameters by themselves. For example:

is short equivalent of the full annotation above.

Contributing

Feel free to make any pull requests.


All versions of microservices with dependencies

PHP Build Version
Package Version
Requires guzzlehttp/guzzle Version ~6|~7
ramsey/uuid Version ~4
ext-json Version *
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 perfumer/microservices contains the following files

Loading the files please wait ....