PHPackages                             karboosx/procer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. karboosx/procer

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

karboosx/procer
===============

Custom language for writing business logic

0.8(1mo ago)249[1 PRs](https://github.com/karboosx/procer/pulls)MITPHPPHP &gt;=8.2CI passing

Since Sep 8Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/karboosx/procer)[ Packagist](https://packagist.org/packages/karboosx/procer)[ Docs](https://github.com/karboosx/procer)[ RSS](/packages/karboosx-procer/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (2)Versions (12)Used By (0)

[![logo](.github/logo.png?raw=true)](.github/logo.png?raw=true)

Procer
======

[](#procer)

[![Tests](https://github.com/karboosx/procer/actions/workflows/tests.yml/badge.svg)](https://github.com/karboosx/procer/actions/workflows/tests.yml)[![Documentation](https://camo.githubusercontent.com/78c36c5de3d0012068b19895e6b8a9f5ec6785e8535aef5e8d93133013c04020/68747470733a2f2f6b6172626f6f73782e6e65742f62616467652f446f63756d656e746174696f6e2d646f6e652d6461726b2d6f72616e67652e737667)](/docs)[![License](https://camo.githubusercontent.com/902fafbe02eee696515ddce9cfcd99e13b1419b71fbaa84624c2a21d231df3cd/68747470733a2f2f6b6172626f6f73782e6e65742f62616467652f4c6963656e73652d4d49542d6461726b2d677265656e2e737667)](LICENSE)[![Composer](https://camo.githubusercontent.com/cdbacc45b610abb9908ce8a2ca00f5a60cada77324e14f82bf390c9ddd13c9f0/68747470733a2f2f6b6172626f6f73782e6e65742f62616467652f436f6d706f7365722d696e7374616c6c2d6461726b2d626c75652e737667)](https://packagist.org/packages/karboosx/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:

```
let shopping_cart be new_shopping_cart(user_account).

let item be product_from_store("apple").

add(item) on shopping_cart.
on user_account do checkout.

```

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](docs/syntax.md) for more information.

Installation
------------

[](#installation)

You can install Procer using composer:

```
composer require karboosx/procer

```

Usage
-----

[](#usage)

```
use Karboosx\Procer;

$procer = new Karboosx\Procer();

$result = $procer->run('let a be 1.');

echo $result->get('a'); // 1
```

### Usage with custom functions

[](#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.

```
use Karboosx\Procer;

$procer = new Karboosx\Procer([
   new CustomFunctionProvider()
]);

$result = $procer->run('let x be custom_function("hello world!").');

echo $result->get('x'); // "custom function result with argument: hello world!"
```

The `CustomFunctionProvider` class should look like this:

```
class CustomFunctionProvider implements \Karboosx\Procer\FunctionProviderInterface
{
    public function custom_function(Context $context, string $argument): string
    {
        return "custom function result with argument: {$argument}";
    }

    public function supports(string $functionName): bool
    {
        return in_array($functionName, ['custom_function']);
    }
}
```

> **Note:** The `supports` method should return `true` if the function is supported by the provider, otherwise it should return `false`.

> **Note:** The `custom_function` method receives a `Context` object as its first argument, followed by the function's arguments as individual parameters (not an array).
>
> The `Context` object provides access to the variables defined in the Procer code.

Check the [Custom Functions documentation](docs/custom_functions.md) for more information.

Evaluation expression
---------------------

[](#evaluation-expression)

If you want to evaluate just an expression, you can use the `runExpression` method of the `Karboosx\Procer` class.

```
use Karboosx\Procer;

$procer = new Procer();

$result = $procer->runExpression('1 + 2 * 3');

echo $result; // 7
```

Check out the [Expression documentation](docs/expressions.md) for more information.

Pausing and resuming execution
------------------------------

[](#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.

```
use Karboosx\Procer;

$procer = new Procer();

$result = $procer->run(resume(null, [], ['test_signal']);

echo $result->get('a'); // 2
```

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](docs/signals.md) for more information.
Also, check out the [Serialization documentation](docs/serialization.md) for more information how to serialize and unserialize the script.

Documentation
-------------

[](#documentation)

### Language

[](#language)

- [Procer Syntax](docs/syntax.md) — variables, loops, conditions, procedures, `stop`, signals
- [Expressions](docs/expressions.md) — operators, precedence, string concatenation, comparisons

### PHP integration

[](#php-integration)

- [Custom Functions](docs/custom_functions.md) — `FunctionProviderInterface`, `Context` API
- [Object Functions](docs/object_functions.md) — `ObjectFunctionProviderInterface`
- [Signals](docs/signals.md) — `wait for signal`, `wait for all signals`, signal statefulness
- [Interrupts](docs/interrupts.md) — pausing from inside a function provider
- [Serialization](docs/serialization.md) — persist and resume a paused process
- [Error Handling](docs/error_handling.md) — exception types and how to catch them
- [Security](docs/security.md) — cycle limits, user-submitted scripts

### Advanced

[](#advanced)

- [In-Depth](docs/in_depth.md) — `InterruptReason`, bytecode debugging, `MathExpressionReflection`, `stopping` loops, cycle counter

User submitted code safeness
----------------------------

[](#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
-------

[](#license)

This project is open-sourced software licensed under the MIT License. Please see [License File](LICENSE) for more information.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance90

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~68 days

Recently: every ~152 days

Total

10

Last Release

48d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7be6dd2898344810998956e079d28cc65ee4b4f6cd06e555b7b09403897701f0?d=identicon)[karboosx](/maintainers/karboosx)

---

Top Contributors

[![karboosx](https://avatars.githubusercontent.com/u/10424847?v=4)](https://github.com/karboosx "karboosx (82 commits)")

---

Tags

parserbuisness logicprocer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/karboosx-procer/health.svg)

```
[![Health](https://phpackages.com/badges/karboosx-procer/health.svg)](https://phpackages.com/packages/karboosx-procer)
```

###  Alternatives

[nikic/php-parser

A PHP parser written in PHP

17.4k954.1M2.5k](/packages/nikic-php-parser)[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k959.8M160](/packages/doctrine-lexer)[erusev/parsedown

Parser for Markdown.

15.1k156.8M870](/packages/erusev-parsedown)[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

3.0k437.5M1.0k](/packages/league-commonmark)[masterminds/html5

An HTML5 parser and serializer.

1.8k269.7M322](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k211.0M75](/packages/sabberworm-php-css-parser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
