Download the PHP package ant-framework/middleware without Composer

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

Ant框架使用的中间件

中间件运行流程

简单的介绍

  1. 因为是基于PHP的协同进行的开发,并且运用了一些新特性,要求使用版本为>=5.6.0
  2. 每次yield后,会挂起当前中间件,执行下一个中间件
  3. yield不是必须的,如果没有yield,此中间件被执行完毕之后不会被再次回调
  4. 在执行完function之后会尝试恢复之前挂起的中间件,恢复的时候可以进行传值
  5. 如果出现了异常,中间件的调用链会停止,然后恢复之前挂起的中间件,尝试使用这些中间件处理异常
  6. 参考 : http://php.net/manual/zh/language.generators.syntax.php

使用

通过yield关键词获取重新入栈的信息

then中闭包函数返回的值,会在恢复中间件的时候传递给每个协同函数,协同函数可以通过$message = yield这样的语法来获取值(更详细的语法可以去参考PHP手册),根据不同的版本有两种方式来改变重新入栈时传递的值,PHP7以上通过return就可以改变传递的值,5.6使用第二个yield返回,注意是第二个

打断中间件调用链

yield false 这种方式会打断中间件的后续所有调用

在中间件的运行过程中,如果出现异常,中间件的往下的调用链会被打断,然后开始回调中间件,回调的过程是以责任链的方式完成,如果内层中间件无法处理异常,那么外层中间件会尝试捕获这个异常,如果一直无法处理,异常将会抛到最顶层来处理,如果处理了这个异常,那么异常回调链将会被打断,程序会返回至中间件启动的位置(内层外层可以参考流程图)


All versions of middleware with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.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 ant-framework/middleware contains the following files

Loading the files please wait ....