PHPackages                             serafim/calc - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. serafim/calc

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

serafim/calc
============

3.2.0(2y ago)16241[1 issues](https://github.com/SerafimArts/Calculator/issues)MITPHPPHP ^8.1

Since Aug 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/SerafimArts/Calculator)[ Packagist](https://packagist.org/packages/serafim/calc)[ RSS](/packages/serafim-calc/feed)WikiDiscussions master Synced today

READMEChangelog (8)Dependencies (4)Versions (10)Used By (0)

Calculator
==========

[](#calculator)

Why?
----

[](#why)

This repository is designed as an example of how you can implement a calculator based on abstract syntax tree generated by the LL(k) recurrence recursive descent parser.

As a grammar used the basic implementation with operators associativity, and not vulnerable to left recursion:

```
{
  tokens = [
    T_FLOAT = "regexp:\d+\.\d+"
    T_INT   = "regexp:\d+"
  ]
}

           ::=  |  |

           ::=  |  |
         ::= "("  ")" |

    ::=  "-"
       ::=  "+"
 ::=  "*"
       ::=  ("/" | "÷")

          ::= T_FLOAT | T_INT

```

Example
-------

[](#example)

Command Line Interface

```
$ php ./bin/cc run
```

[![image](https://user-images.githubusercontent.com/2461257/191113809-7a637fc2-71e0-48f7-a080-3998bab5edaa.png)](https://user-images.githubusercontent.com/2461257/191113809-7a637fc2-71e0-48f7-a080-3998bab5edaa.png)

[![image](https://user-images.githubusercontent.com/2461257/191683008-9566dc7e-5ff3-4648-b2e1-fddf35caf363.jpg)](https://user-images.githubusercontent.com/2461257/191683008-9566dc7e-5ff3-4648-b2e1-fddf35caf363.jpg)

Usage
-----

[](#usage)

**Global:**

```
$ composer global require serafim/calc
$ cc run
```

**Local:**

```
$ composer require serafim/calc
$ ./vendor/bin/cc run
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 92.3% 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 ~240 days

Recently: every ~141 days

Total

8

Last Release

763d ago

Major Versions

1.0.0 → 2.0.02019-12-16

2.0.1 → 3.0.02022-09-19

PHP version history (3 changes)1.0.0PHP &gt;=7.1

2.0.0PHP &gt;=7.4

3.0.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/150420?v=4)[Ruslan Sharipov](/maintainers/Serafim)[@serafim](https://github.com/serafim)

---

Top Contributors

[![SerafimArts](https://avatars.githubusercontent.com/u/2461257?v=4)](https://github.com/SerafimArts "SerafimArts (24 commits)")[![HMRDevil](https://avatars.githubusercontent.com/u/13382415?v=4)](https://github.com/HMRDevil "HMRDevil (2 commits)")

### Embed Badge

![Health badge](/badges/serafim-calc/health.svg)

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

###  Alternatives

[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[phel-lang/phel-lang

Phel is a functional programming language that compiles to PHP

4743.5k10](/packages/phel-lang-phel-lang)[symfony/ai-bundle

Integration bundle for Symfony AI components

30282.3k6](/packages/symfony-ai-bundle)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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