Download the PHP package karboosx/procer without Composer
On this page you can find all versions of the php package karboosx/procer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download karboosx/procer
More information about karboosx/procer
Files in karboosx/procer
Package procer
Short Description Custom language for writing business logic
License MIT
Homepage https://github.com/karboosx/procer
Informations about the package procer
Procer
Procer is a simple and lightweight language designed to describe processes and workflows in a natural and human-readable way. The big advantage of Procer is that it functions can halt the execution of the code and wait for a signal to resume the execution.
Example code:
Each function call
in this example code (new_shopping_cart
, product_from_store
, add
, checkout
) is actually a function in php land.
Here you only write the business logic and the implementation is done in php.
Check the Procer Syntax for more information.
Installation
You can install Procer using composer:
Usage
Usage with custom functions
In order to use custom functions in Procer, you need to create a class that implements the FunctionProviderInterface
interface and pass an instance of this class to the Karboosx\Procer
constructor.
The CustomFunctionProvider
class should look like this:
Note: The
supports
method should returntrue
if the function is supported by the provider, otherwise it should returnfalse
.Note: The
custom_function
method should have aContext
object as the first argument and an array of arguments as the second argument.The
Context
object contains the variables that were defined in the Procer code.
Check the Custom Functions documentation for more information.
Evaluation expression
If you want to evaluate just an expression, you can use the runExpression
method of the Karboosx\Procer
class.
Check out the Expression documentation for more information.
Pausing and resuming execution
You can pause the execution of the Procer code and resume it later by resume
method.
Good way to stop the execution is to use the wait for signal
statement.
That way you can pause the execution of the script at one point. Wait for user input, or for some event to happen, and then resume the execution of the script.
Check out the Signals documentation for more information.
Also, check out the Serialization documentation for more information how to serialize and unserialize the script.
Documentation
- Procer Syntax
- Signals
- Interrupts
- Custom Functions
- Serialization
- Expressions
- Security
User submitted code safeness
Code submitted by users is safe to run as far as the provided functions are safe.
Procer does not allow to run any php code (except for the provided functions) and does not allow to include files, write to files, read from files, create objects, use eval, or have access to global variables.
License
This project is open-sourced software licensed under the MIT License. Please see License File for more information.
All versions of procer with dependencies
ext-ctype Version *