phil / commerce-subscription-bundle
Subscriptions in Symfony on phil/commerce-bundle: tiers, billing periods, trials, renewal and dunning, proration, gifts, seats, the features each tier unlocks.
Package info
github.com/parler-haut-interagir-librement/commerce-subscription-bundle
Type:symfony-bundle
pkg:composer/phil/commerce-subscription-bundle
Requires
- php: >=8.5
- doctrine/orm: ^3.7
- phil/commerce-bundle: ^0.2@dev || ^0.3@dev
- phil/ddd-bundle: ^0.1@dev
- phil/money: ^0.1@dev
- psr/clock: ^1.0
- symfony/config: ^8.2
- symfony/dependency-injection: ^8.2
- symfony/uid: ^8.2
Requires (Dev)
- doctrine/dbal: ^4.5
- doctrine/doctrine-bundle: ^3.3
- doctrine/persistence: ^4.1
- phpunit/phpunit: ^13.4
- psr/log: ^3.0
- symfony/clock: ^8.2
- symfony/event-dispatcher: ^8.2
- symfony/framework-bundle: ^8.2
- symfony/http-kernel: ^8.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-21 03:05:32 UTC
README
Recurring offers in tiers, with trials, renewal, dunning, proration, gifts and the features each tier unlocks.
phil/commerce-subscription-bundle is the subscription module of phil/commerce-bundle. It holds offers ranked as
tiers of a family, free and paid tiers or support tiers in one model. It starts subscriptions with or without a
trial, orders each billing period through the core, renews, retries failed payments, and cancels at the end of the
paid period. It changes tier at the next renewal, or at once with the unused part of the period credited. A buyer
offers a subscription to someone else with a code. It tells which features a subscriber may use, and opens an
organization's subscription to its members, with optional seats. With DoctrineBundle, offers, subscriptions, gifts
and seats are stored.
While a renewal is past due, each offer's dunning stages say what the subscriber keeps after so many days: every feature by default, some, or none.
It is for an application that sells access by the period, a membership or a plan. Most applications that sell access
need the core and this module only; a catalogue of products belongs to phil/commerce-catalog-bundle.
It is a Symfony bundle that refuses to load without the core. Each period is ordered at the offer's current price,
never a price from a form; every amount is a Money in the order's currency, and the core taxes each line.
Offers answer the core's SellableResolver under the reference type offer, so each period is an ordinary order of
the core; a change at once is prorated by an OrderProcessor before the core taxes it. The application reads
FeatureAccess to open or close a feature for a subscriber.
Status
| Part | State |
|---|---|
| Offers and tiers, periods counted from an anchor | Implemented and tested |
| Subscriptions: trials, renewal by an order of the core, dunning, cancellation, changes of tier | Implemented and tested |
| Immediate changes with proration | Implemented and tested |
| Gifts redeemed by a code | Implemented and tested |
| Organizations, with optional seats | Implemented and tested |
| Feature access per tier | Implemented and tested |
| Dunning stages per offer: every feature, some or none after so many days past due | Implemented and tested |
| Storage on Doctrine | Implemented and tested |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, installing and registering the module beside the core. |
| Configuration | The keys, and the services the module registers. |
| Offers | Offers and tiers, periods, selling through the core, storage. |
| Subscriptions | States, the loop the application keeps, periods, cancelling, changing tier, storage. |
| Changing tier at once | What is charged and credited, rounding, which changes are prorated. |
| Gifts | Buying, the code, the beneficiary, what happens after the periods paid. |
| Organizations | Membership through a port, what a member may use, seats. |
| Features | What a subscriber or a member may use. |
| Dunning | What a subscriber keeps while a renewal is past due, stage by stage. |
| Scope | What the module holds, what it leaves to other packages and the seam with them, and the ports of the core it implements. |
| Extension points | What an application implements, configures, replaces or relies on. |
| Testing | How the module is tested, and how to run its tests. |
| Reference | Every public type of the module. |
Quick start
composer require phil/commerce-bundle phil/commerce-subscription-bundle
// config/bundles.php return [ // ... Phil\CommerceBundle\PhilCommerceBundle::class => ['all' => true], Phil\CommerceSubscriptionBundle\PhilCommerceSubscriptionBundle::class => ['all' => true], ];
Requirements
PHP 8.5 or later; phil/commerce-bundle, phil/ddd-bundle and phil/money 0.1; Doctrine ORM 3.7; psr/clock 1.0; symfony/uid,
symfony/config and symfony/dependency-injection 8.2 or later.
Contributing
Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.
License
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.