{"id":21373052,"url":"https://github.com/hiqdev/php-billing","last_synced_at":"2025-04-04T16:14:52.755Z","repository":{"id":18837852,"uuid":"85413514","full_name":"hiqdev/php-billing","owner":"hiqdev","description":"PHP Billing Library","archived":false,"fork":false,"pushed_at":"2025-03-12T15:18:21.000Z","size":1132,"stargazers_count":55,"open_issues_count":5,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-28T15:08:17.362Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hiqdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-18T15:57:36.000Z","updated_at":"2025-03-12T15:18:26.000Z","dependencies_parsed_at":"2024-01-15T17:13:21.204Z","dependency_job_id":"6bfe6710-d58c-4cde-8373-98b17ac397c7","html_url":"https://github.com/hiqdev/php-billing","commit_stats":{"total_commits":650,"total_committers":9,"mean_commits":72.22222222222223,"dds":"0.24769230769230766","last_synced_commit":"525bd98c8728006be571a042e017c6f4950a3f16"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiqdev%2Fphp-billing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiqdev%2Fphp-billing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiqdev%2Fphp-billing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiqdev%2Fphp-billing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hiqdev","download_url":"https://codeload.github.com/hiqdev/php-billing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208151,"owners_count":20901570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-11-22T08:24:54.280Z","updated_at":"2025-04-04T16:14:52.735Z","avatar_url":"https://github.com/hiqdev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Billing\n\n**PHP Billing Library**\n\n[![Latest Stable Version](https://poser.pugx.org/hiqdev/php-billing/v/stable)](https://packagist.org/packages/hiqdev/php-billing)\n[![Total Downloads](https://poser.pugx.org/hiqdev/php-billing/downloads)](https://packagist.org/packages/hiqdev/php-billing)\n![phpunit-tests](https://github.com/hiqdev/php-billing/actions/workflows/phpunit-tests.yml/badge.svg)\n![behat-tests](https://github.com/hiqdev/php-billing/actions/workflows/behat-tests.yml/badge.svg)\n[![Build Status](https://img.shields.io/travis/hiqdev/php-billing.svg)](https://travis-ci.org/hiqdev/php-billing)\n[![Scrutinizer Code Coverage](https://img.shields.io/scrutinizer/coverage/g/hiqdev/php-billing.svg)](https://scrutinizer-ci.com/g/hiqdev/php-billing/)\n[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/hiqdev/php-billing.svg)](https://scrutinizer-ci.com/g/hiqdev/php-billing/)\n\nBilling library providing:\n\n- customers with subscriptions\n- orders with actions\n- tariff plans with prices\n- smart discounts with formulas\n- bills with charges\n- calculator and aggregator\n\n- one-time, metered and recurring charging\n\nPlease see [additional documentation in russian](docs/ru.md).\n\n## Installation\n\nThe preferred way to install this library is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```sh\nphp composer.phar require \"hiqdev/php-billing\"\n```\n\nor add\n\n```json\n\"hiqdev/php-billing\": \"*\"\n```\n\nto the require section of your composer.json.\n\n## Idea\n\nIn general the billing functions like this:\n\nFor a given [order] a [calculator] finds [plan]s and then matches\napplicable [price]s to [action]s and calculates [charge]s.\nThen [charge]s can be aggregated to [bill]s with [aggregator].\n\nBilling operates such ideas:\n\n- [Action] - [customer]'s metered activity of a certain [type] at a certain [target]\n- [Order] - collection of [action]s\n- [Bill]\n- [Charge]\n- [Plan]\n- [Price]\n- [Customer]\n- [Sale] - a subscription, binding [customer] to a [target] and a [plan]\n- [Target] - object being charged in billing\n- [Type]\n- [Calculator]\n- [Aggregator]\n\n![Model UML](http://www.plantuml.com/plantuml/proxy?cache=no\u0026src=https://raw.githubusercontent.com/hiqdev/php-billing/master/docs/model.puml)\n\n[Action]:       /src/action/Action.php\n[Aggregator]:   /src/tools/Aggregator.php\n[Bill]:         /src/bill/Bill.php\n[Calculator]:   /src/order/Calculator.php\n[Charge]:       /src/charge/Charge.php\n[Customer]:     /src/customer/Customer.php\n[Order]:        /src/order/Order.php\n[Plan]:         /src/plan/Plan.php\n[Price]:        /src/price/AbstractPrice.php\n[SinglePrice]:  /src/price/SinglePrice.php\n[EnumPrice]:    /src/price/EnumPrice.php\n[Sale]:         /src/sale/Sale.php\n[Target]:       /src/target/Target.php\n[Type]:         /src/type/Type.php\n\n## Disclaimer\n\nThis billing is designed to be flexible and abstract, so supports different use cases.\nWe use this package in production, wrapping it additional layers, such as:\n\n1. Plan and Price storage and management UI for managers, so they can create plans,\n   fill them with prices and assign to Customers.\n2. Actions and Orders producer. This layer takes end-user actions\n   (such as purchasing something) and produces the right Actions inside the Order\n3. Persistence layer. This layer implements various RepositoryInterfaces,\n   defined in this package (such as PlanRepositoryInterface,\n   providing data saving and retrieving logic for the required entities.\n4. Periodic operations (CRON tasks). This includes meters fetching\n   (such as accumulated resources consumption), transforming them to actions\n   with the right quantity, running billing on them, updating Bills and their Charges.\n5. Business metrics monitoring, analysis and alerting.\n   This layer provides regular checks over data, produces by the billing in order to ensure system health.\n6. Read API. This API accepts requests, fetches data from the DBMS\n   and implements search with filtering, ordering, access control\n   and more for Orders, Actions, Bills, Prices and so on.\n\nSo, as you can see, this package is a concrete foundation of big billing system,\nbut it requires a lot of bricks on top of it to become a fully operable billing.\nUnfortunately, we do not have all those bricks open-sourced and documented\nbecause many of them implement customer-specific logic that cannot be disclosed.\n\n## License\n\nThis project is released under the terms of the BSD-3-Clause [license](LICENSE).\nRead more [here](http://choosealicense.com/licenses/bsd-3-clause).\n\nCopyright © 2017-2019, HiQDev (http://hiqdev.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiqdev%2Fphp-billing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhiqdev%2Fphp-billing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiqdev%2Fphp-billing/lists"}