Download the PHP package sdpmlab/anser without Composer

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

Anser: PHP Microservices Orchestration Library

logo

Anser is a PHP-based microservices orchestration library. You can use this library to manage connections and orchestrate your microservices. Through the Anser library, you can easily achieve the following goals:

正體中文文件

Installation

Install Anser library via Composer:

Quick Start

Microservices Connection List

In your project, you must set the microservices connection list during the execution cycle. You can set it through the ServiceList::addLocalService() method. You can refer to the example we provide to create your microservices connection list, which will be the basis for all microservices connections.

Abstract Microservice

In Anser, you can abstract all endpoints of a microservice through the SimpleService class. We provide an example, you can refer to it to quickly create a microservice class:

You can directly refer to the Anser-Action library to understand what mechanism Anser provides to handle microservices connections.

orchestrate Microservices

In Anser, you can orchestrate your microservices through the Orchestrator class. We provide an example, you can refer to it to quickly create an orchestration class:

In the above example, we can see that in the definition method, we use the setStep() method to define the behavior of each step, and use the addAction() method to define the logic required for each step.

In addAction(), you can pass in two types to achieve different orchestration needs:

  1. Pass in the instance of SDPMlab\Anser\Service\ActionInterface. When the microservices orchestrator executes this step, it will directly use this Action instance to communicate with the microservices.
  2. Pass in callable. When the microservices orchestrator executes this step, it will execute this Closure and pass in the Runtime Orchestrator. You can get the data of other steps through the Runtime Orchestrator instance to meet more logical requirements, and return the instance of SDPMlab\Anser\Service\ActionInterface at the end.

Use the transStart() method to start a Saga transaction, and end the Saga transaction in the transEnd() method. Then, you can use the setCompensationMethod() method to define the compensation behavior of each step. When the step fails, the compensation behavior will be executed automatically.

Define Compensation

In the above example, we can see that in the definition method, we use the setCompensationMethod() method to define the compensation behavior of each step. When the step fails, the compensation behavior will be executed automatically.

You must implement the SDPMlab\Anser\Orchestration\Saga\SimpleSaga class to define your compensation logic, and get the Runtime Orchestrator instance through the getOrchestrator() method in the compensation logic. You can get the data of other steps through the Runtime Orchestrator instance to meet more logical requirements.

Execute the microservices orchestration logic

Depending on the framework you are using, you will need to execute your Orchestrator somewhere.

Here is a rough example:

We can see that in the createOrder() method, we new CreateOrderOrchestrator(); an Orchestrator instance, and use the build() method to start a service collaboration with Saga transaction, and pass in the product_key, product_amout, user_key three parameters in the build() method, these parameters will be used in the definition() method.

Finally, you will get the return value after the build() is completed. This return value comes from the data processed by defineResult().

The above is a full-featured example of the use of Anser Orchestrator Saga. You can use this example to understand how to use Anser Orchestrator.

License

Anser is released under the MIT License. See the bundled LICENSE,


All versions of anser with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4||^8.0
sdpmlab/anser-action Version ^0.3.0
predis/predis Version ^2.0
pingyi/json-serializer Version ^0.1.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 sdpmlab/anser contains the following files

Loading the files please wait ....