PHPackages                             hiqdev/php-billing - 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. hiqdev/php-billing

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

hiqdev/php-billing
==================

PHP Billing Library

5918.3k11[1 issues](https://github.com/hiqdev/php-billing/issues)[5 PRs](https://github.com/hiqdev/php-billing/pulls)1PHPCI passing

Since May 17Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/hiqdev/php-billing)[ Packagist](https://packagist.org/packages/hiqdev/php-billing)[ RSS](/packages/hiqdev-php-billing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (19)Used By (1)

PHP Billing Library
===================

[](#php-billing-library)

[![Latest Stable Version](https://camo.githubusercontent.com/1f2bec3516a9c28316721f833d01fb96a30b9164aecd208be3178dcd719876bf/68747470733a2f2f706f7365722e707567782e6f72672f6869716465762f7068702d62696c6c696e672f762f737461626c65)](https://packagist.org/packages/hiqdev/php-billing)[![Total Downloads](https://camo.githubusercontent.com/97573673e7152bbb10be71b0d6b28dbb60366b7927c1954e3d355d9193d5612f/68747470733a2f2f706f7365722e707567782e6f72672f6869716465762f7068702d62696c6c696e672f646f776e6c6f616473)](https://packagist.org/packages/hiqdev/php-billing)[![phpunit-tests](https://github.com/hiqdev/php-billing/actions/workflows/phpunit-tests.yml/badge.svg)](https://github.com/hiqdev/php-billing/actions/workflows/phpunit-tests.yml/badge.svg)[![behat-tests](https://github.com/hiqdev/php-billing/actions/workflows/behat-tests.yml/badge.svg)](https://github.com/hiqdev/php-billing/actions/workflows/behat-tests.yml/badge.svg)

A pure domain library for billing and invoicing. It models the full billing pipeline: [Customer](/src/customer/Customer.php)s subscribe to [Target](/src/target/Target.php)s under [Plan](/src/plan/Plan.php)s (via [Sale](/src/sale/Sale.php)s), metered activities are recorded as [Action](/src/action/Action.php)s, the [Calculator](/src/order/Calculator.php) matches Actions to [Price](/src/price/AbstractPrice.php)s within Plans to produce [Charge](/src/charge/Charge.php)s, and the [Aggregator](/src/tools/Aggregator.php) groups Charges into [Bill](/src/bill/Bill.php)s.

The library supports one-time, metered, and recurring charging with multiple pricing strategies (fixed per-unit, percentage-based, tiered/progressive, discrete lookup), a formula DSL for smart discounts and installments, and a reseller hierarchy.

No framework dependency — this is a standalone domain model.

Core Entities
-------------

[](#core-entities)

- **[Action](/src/action/Action.php)** — a [Customer](/src/customer/Customer.php)'s metered activity of a certain [Type](/src/type/Type.php) at a certain [Target](/src/target/Target.php)
- **[Order](/src/order/Order.php)** — a collection of Actions to be billed together
- **[Sale](/src/sale/Sale.php)** — a subscription binding a [Customer](/src/customer/Customer.php) to a [Target](/src/target/Target.php) under a [Plan](/src/plan/Plan.php)
- **[Plan](/src/plan/Plan.php)** — a tariff containing a set of [Price](/src/price/AbstractPrice.php)s
- **[Price](/src/price/AbstractPrice.php)** — a billing rule that calculates charges (SinglePrice, EnumPrice, RatePrice, ProgressivePrice)
- **[Charge](/src/charge/Charge.php)** — the result of matching an Action to a Price
- **[Bill](/src/bill/Bill.php)** — aggregation of Charges into an invoice line item
- **[Calculator](/src/order/Calculator.php)** — orchestrates the billing pipeline
- **[Aggregator](/src/tools/Aggregator.php)** — groups Charges into Bills

[![Model UML](https://camo.githubusercontent.com/e72f56f239669b2a458f21225db293a8080ce99502c91f9cc26afc12aff4f1ce/687474703a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f63616368653d6e6f267372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f6869716465762f7068702d62696c6c696e672f6d61737465722f646f63732f6d6f64656c2e70756d6c)](https://camo.githubusercontent.com/e72f56f239669b2a458f21225db293a8080ce99502c91f9cc26afc12aff4f1ce/687474703a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f63616368653d6e6f267372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f6869716465762f7068702d62696c6c696e672f6d61737465722f646f63732f6d6f64656c2e70756d6c)

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

[](#documentation)

- [Domain Model](docs/domain-model.md) — core entities, matching rules, immutability, calculator pipeline
- [Price Types](docs/price-types.md) — SinglePrice, EnumPrice, RatePrice, ProgressivePrice algorithms
- [Formula DSL and Charge Modifiers](docs/formula-and-modifiers.md) — discount, installment, cap, and modifier system
- [Codebase Overview](docs/overview.md) — directory map, patterns, and testing

Disclaimer
----------

[](#disclaimer)

This billing is designed to be flexible and abstract, so supports different use cases. We use this package in production, wrapping it additional layers, such as:

1. Plan and Price storage and management UI for managers, so they can create plans, fill them with prices and assign to Customers.
2. Actions and Orders producer. This layer takes end-user actions (such as purchasing something) and produces the right Actions inside the Order
3. Persistence layer. This layer implements various RepositoryInterfaces, defined in this package (such as PlanRepositoryInterface, providing data saving and retrieving logic for the required entities.
4. Periodic operations (CRON tasks). This includes meters fetching (such as accumulated resources consumption), transforming them to actions with the right quantity, running billing on them, updating Bills and their Charges.
5. Business metrics monitoring, analysis and alerting. This layer provides regular checks over data, produces by the billing in order to ensure system health.
6. Read API. This API accepts requests, fetches data from the DBMS and implements search with filtering, ordering, access control and more for Orders, Actions, Bills, Prices and so on.

So, as you can see, this package is a concrete foundation of big billing system, but it requires a lot of bricks on top of it to become a fully operable billing. Unfortunately, we do not have all those bricks open-sourced and documented because many of them implement customer-specific logic that cannot be disclosed.

License
-------

[](#license)

This project is released under the terms of the BSD-3-Clause [license](LICENSE). Read more [here](http://choosealicense.com/licenses/bsd-3-clause).

Copyright © 2017-2026, HiQDev ()

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance57

Moderate activity, may be stable

Popularity38

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.4% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/790fd24da129907d373559f60c6994f664f06e3f518502c03580cc9f3594615e?d=identicon)[hiqdev](/maintainers/hiqdev)

![](https://www.gravatar.com/avatar/99106256c24a8cb23871b99fa90e48f37f1aa71608c185759b7d2a88683a5918?d=identicon)[hiqsol](/maintainers/hiqsol)

---

Top Contributors

[![hiqsol](https://avatars.githubusercontent.com/u/11820365?v=4)](https://github.com/hiqsol "hiqsol (493 commits)")[![SilverFire](https://avatars.githubusercontent.com/u/4499203?v=4)](https://github.com/SilverFire "SilverFire (167 commits)")[![VadymHrechukha](https://avatars.githubusercontent.com/u/114911409?v=4)](https://github.com/VadymHrechukha "VadymHrechukha (153 commits)")[![tafid](https://avatars.githubusercontent.com/u/3338188?v=4)](https://github.com/tafid "tafid (21 commits)")[![bladeroot](https://avatars.githubusercontent.com/u/10207103?v=4)](https://github.com/bladeroot "bladeroot (20 commits)")[![ValeriyShnurovoy](https://avatars.githubusercontent.com/u/16237008?v=4)](https://github.com/ValeriyShnurovoy "ValeriyShnurovoy (14 commits)")[![strorch](https://avatars.githubusercontent.com/u/23340907?v=4)](https://github.com/strorch "strorch (3 commits)")[![gadezist](https://avatars.githubusercontent.com/u/39760138?v=4)](https://github.com/gadezist "gadezist (2 commits)")[![marclaporte](https://avatars.githubusercontent.com/u/1004261?v=4)](https://github.com/marclaporte "marclaporte (1 commits)")

---

Tags

hacktoberfest

### Embed Badge

![Health badge](/badges/hiqdev-php-billing/health.svg)

```
[![Health](https://phpackages.com/badges/hiqdev-php-billing/health.svg)](https://phpackages.com/packages/hiqdev-php-billing)
```

###  Alternatives

[cagartner/correios-consulta

Package para pesquisa de serviços de busca por cep, calculo de frete e etc, diretamente nos serviços dos Correios.

159301.8k](/packages/cagartner-correios-consulta)

PHPackages © 2026

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