PHPackages                             prestashopcorp/module-lib-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. prestashopcorp/module-lib-billing

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

prestashopcorp/module-lib-billing
=================================

Utility package to retrieve Built for PS context and more

4.0.0(1y ago)129.2k↓14.1%2[1 PRs](https://github.com/PrestaShopCorp/module-lib-billing/pulls)2MITPHPPHP &gt;=5.6CI passing

Since Feb 16Pushed 1y ago5 watchersCompare

[ Source](https://github.com/PrestaShopCorp/module-lib-billing)[ Packagist](https://packagist.org/packages/prestashopcorp/module-lib-billing)[ RSS](/packages/prestashopcorp-module-lib-billing/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (23)Used By (2)

PrestaShop Billing Lib
======================

[](#prestashop-billing-lib)

Utility package to retrieve Built for PS context and more

[![Latest Stable Version](https://camo.githubusercontent.com/3d7d6ba7a09f806d7d42365e60d35202f7c9442661aa0ef81e42405e3259bccd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70726573746173686f70636f72702f6d6f64756c652d6c69622d62696c6c696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/prestashopcorp/module-lib-billing) [![Minimum PHP Version](https://camo.githubusercontent.com/c308bc60fd70a2672917b5d79fdc6bd664c9bb7e40980cf6cffc93dabd681728/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e322e352d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/) [![Quality Control PHP](https://github.com/PrestaShopCorp/module-lib-billing/actions/workflows/billing-qc-php.yml/badge.svg)](https://github.com/PrestaShopCorp/module-lib-billing/actions/workflows/billing-qc-php.yml)

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

[](#installation)

This package is available on [Packagist](https://packagist.org/packages/prestashopcorp/module-lib-billing), you can install it via [Composer](https://getcomposer.org).

```
composer require prestashopcorp/module-lib-billing
```

Version Guidance
----------------

[](#version-guidance)

VersionStatusPackagist -NamespaceRepoDocsPHP Version1.xSecurity fixes`module-lib-billing``PrestaShopCorp\Billing`[v1](https://github.com/PrestaShopCorp/module-lib-billing/tree/1.x)N/A&gt;=5.62.xSecurity fixes`module-lib-billing``PrestaShopCorp\Billing`[v2](https://github.com/PrestaShopCorp/module-lib-billing/tree/2.x)N/A&gt;=7.2.53.xLatest`module-lib-billing``PrestaShopCorp\Billing`[v3](https://github.com/PrestaShopCorp/module-lib-billing/tree/2.3)N/A&gt;=5.64.xLatest`module-lib-billing``PrestaShopCorp\Billing`[v4](https://github.com/PrestaShopCorp/module-lib-billing)N/A&gt;=5.6Register as a service in your PSx container
-------------------------------------------

[](#register-as-a-service-in-your-psx-container)

Beforehand, you must have defined [PS Account services](https://github.com/PrestaShopCorp/prestashop-accounts-installer#register-as-a-service-in-your-psx-container-recommended)

Example :

```
services:
  #####################
  # PS Billing
  ps_billings.context_wrapper:
    class: 'PrestaShopCorp\Billing\Wrappers\BillingContextWrapper'
    arguments:
      - '@ps_accounts.facade'
      - '@builtfor_example.context'
      - true # if true you are in sandbox mode, if false or empty not in sandbox

  ps_billings.facade:
    class: 'PrestaShopCorp\Billing\Presenter\BillingPresenter'
    arguments:
      - '@ps_billings.context_wrapper'
      - '@builtfor_example.module'
```

How to use it
-------------

[](#how-to-use-it)

### Presenter

[](#presenter)

For example in your main module's class `getContent` method.

```
  // Load context for PsBilling
  $billingFacade = $this->getService('ps_billings.facade');

  // Remove this if you don't need to set an image
  $partnerLogo = $this->getLocalPath() . ' views/img/partnerLogo.png';

  // Billing
  Media::addJsDef($billingFacade->present([
      'logo' => $partnerLogo,
      'tosLink' => 'https://yoururl/',
      'privacyLink' => 'https://yoururl/',
      'emailSupport' => 'you@email',
  ]));
```

Contribute
----------

[](#contribute)

### Pre-commit Hook: Code Validation with PHP-CS-Fixer

[](#pre-commit-hook-code-validation-with-php-cs-fixer)

This project uses a **pre-commit hook** to ensure the code follows the standards defined by `PHP-CS-Fixer`. Before each commit, the hook automatically performs a check and blocks the commit if any style issues are detected.

#### Installation

[](#installation-1)

The hook is automatically installed when you run one of the following commands:

```
# Install dependencies
$ composer install

# Update dependencies
$ composer update
```

#### How It Works

[](#how-it-works)

During a commit (git commit), the hook runs:

```
PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix
```

#### Troubleshooting

[](#troubleshooting)

- Manually reinstall the hook: If the hook is not installed or was removed, you can reinstall it manually by running:

    ```
    bash scripts/install-hooks.sh
    ```
- Bypass the hook temporarily: If you need to bypass the hook for a specific commit, use the `--no-verify` option:

    ```
    git commit --no-verify
    ```

    ⚠️ Note: Use this option cautiously, as it skips all pre-commit checks.

### Automatic tests

[](#automatic-tests)

#### Install

[](#install)

Please follow theses steps to launch unit tests

```
# Needs to have wget, for OS without wget pleae see the official website (or just visit this link)
PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;")
if [[ ${PHP_VERSION} -gt "72" ]]; then
  wget -O phpunit https://phar.phpunit.de/phpunit-9.phar
else
  wget -O phpunit https://phar.phpunit.de/phpunit-8.phar
fi

chmod +x phpunit

# Should display the version
./phpunit --version
```

#### Run

[](#run)

```
./phpunit tests
```

### Introduce a breaking change in module-lib-billing

[](#introduce-a-breaking-change-in-module-lib-billing)

PrestaShop module system is not able to handle multiple version of the same library.

**Here is an example:**

- Module A requires the v1 of a libA
- Module B requires the v2 of this same libA

If someone install module A then module B, only the v1 of libA will be loaded for both Module A and Module B.

#### Workaround

[](#workaround)

When introducing a breaking change to a class or method signature, you should instead create a new class rather to changing the existing one.

By creating a new class it will force the autoloader to use the last version of the lib.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance42

Moderate activity, may be stable

Popularity30

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 74.6% 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 ~62 days

Recently: every ~128 days

Total

18

Last Release

483d ago

Major Versions

1.3.1 → v8.x-dev2022-09-16

1.3.2 → 2.0.02022-09-27

1.x-dev → 3.0.02023-06-22

3.3.1 → 4.0.02025-01-20

PHP version history (2 changes)1.0.0PHP &gt;=5.6

v8.x-devPHP ^7.2.5 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15106407?v=4)[Jarvis](/maintainers/ps-jarvis)[@ps-jarvis](https://github.com/ps-jarvis)

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

![](https://www.gravatar.com/avatar/051c648d356baf13d06b85597440404986973b97003fbd239bd2e65ee40749d7?d=identicon)[khanhmas](/maintainers/khanhmas)

![](https://www.gravatar.com/avatar/071f63d9ee1687c189aee31b88ad468a7f6c0491a9f3230aa64860c649b9d41d?d=identicon)[TakeshiDaveau](/maintainers/TakeshiDaveau)

---

Top Contributors

[![jmcollin](https://avatars.githubusercontent.com/u/3930246?v=4)](https://github.com/jmcollin "jmcollin (50 commits)")[![TakeshiDaveau](https://avatars.githubusercontent.com/u/1732582?v=4)](https://github.com/TakeshiDaveau "TakeshiDaveau (8 commits)")[![maximesimoncelli](https://avatars.githubusercontent.com/u/36240090?v=4)](https://github.com/maximesimoncelli "maximesimoncelli (7 commits)")[![khanhmas](https://avatars.githubusercontent.com/u/8402110?v=4)](https://github.com/khanhmas "khanhmas (1 commits)")[![Quetzacoalt91](https://avatars.githubusercontent.com/u/6768917?v=4)](https://github.com/Quetzacoalt91 "Quetzacoalt91 (1 commits)")

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/prestashopcorp-module-lib-billing/health.svg)

```
[![Health](https://phpackages.com/badges/prestashopcorp-module-lib-billing/health.svg)](https://phpackages.com/packages/prestashopcorp-module-lib-billing)
```

PHPackages © 2026

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