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.6(1y ago)244MITPHPPHP &gt;=8.2CI failing

Since Sep 8Pushed 11mo 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 1mo ago

READMEChangelog (8)Dependencies (1)Versions (9)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, array $arguments): string
    {
        return "custom function result with argument: {$arguments[0]}";
    }

    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 should have a `Context` 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](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($context, [], ['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)

- [Procer Syntax](docs/syntax.md)
- [Signals](docs/signals.md)
- [Interrupts](docs/interrupts.md)
- [Custom Functions](docs/custom_functions.md)
- [Serialization](docs/serialization.md)
- [Expressions](docs/expressions.md)
- [Security](docs/security.md)

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

30

—

LowBetter than 64% of packages

Maintenance47

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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 ~4 days

Total

8

Last Release

580d 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 (77 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.4k902.6M1.8k](/packages/nikic-php-parser)[doctrine/lexer

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

11.2k910.8M117](/packages/doctrine-lexer)[erusev/parsedown

Parser for Markdown.

15.0k151.8M724](/packages/erusev-parsedown)[league/commonmark

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

2.9k404.0M698](/packages/league-commonmark)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M226](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M63](/packages/sabberworm-php-css-parser)

PHPackages © 2026

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