Download the PHP package vitorsreis/extend-caller without Composer
On this page you can find all versions of the php package vitorsreis/extend-caller. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vitorsreis/extend-caller
More information about vitorsreis/extend-caller
Files in vitorsreis/extend-caller
Informations about the package extend-caller
Middleware caller for PHP
Flexible and powerful middleware caller for PHP, supporting multiple middlewares in a queue with contexts and persistent data Unit tests have passed on versions: , , , and
Install
Usage
Simple usage
Multiple middlewares
You can use multiple middlewares in queue, the result of each middleware is passed as argument to next middleware.
Context param
Context contains all information about the current execution. Use an argument with the name "$context" with an omitted type or of type "mixed," or use any name with the type "\VSR\Extend\Caller\Context" in middlewares or in the constructor of a class if the middleware is a non-static class method at any position to receive the argument information.
Property | Description |
---|---|
Current execution state | |
Current execution position on queue middleware | |
Total execution queue middlewares count | |
Execution start time | |
Execution end time | |
Execution time | |
Partial/Final execution result | |
Get persistent data | |
Set persistent data | |
Check if persistent data exists | |
Delete persistent data | |
Stop queue execution | |
or | Result as string |
You can persist data in context so that it is persisted in future callbacks.
Supported middleware callback types
-
Native function name
-
Function name
-
Anonymous function
-
Arrow function, PHP 7.4+
-
Variable function
-
Class method
-
Class static method
-
Class method with constructor
-
Class name/object
- Anonymous class, PHP 7+