PHPackages                             remp/crm-subscriptions-module - 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. remp/crm-subscriptions-module

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

remp/crm-subscriptions-module
=============================

CRM Subscriptions Module

4.4.0(5mo ago)051.2k—9.5%7[2 PRs](https://github.com/remp2020/crm-subscriptions-module/pulls)1MITPHPPHP ^8.1

Since Oct 22Pushed 5mo ago6 watchersCompare

[ Source](https://github.com/remp2020/crm-subscriptions-module)[ Packagist](https://packagist.org/packages/remp/crm-subscriptions-module)[ Docs](https://remp2030.com)[ RSS](/packages/remp-crm-subscriptions-module/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)DependenciesVersions (95)Used By (1)

CRM Subscriptions Module
========================

[](#crm-subscriptions-module)

[![Translation status @ Weblate](https://camo.githubusercontent.com/4e002e7e5b3857c17a5f296a41210e3ddd5924bdb5f8634d3af0fc39e84fccb7/68747470733a2f2f686f737465642e7765626c6174652e6f72672f776964676574732f72656d702d63726d2f2d2f737562736372697074696f6e732d6d6f64756c652f7376672d62616467652e737667)](https://hosted.weblate.org/projects/remp-crm/subscriptions-module/)

This documentation describes API handlers provided by this module for others to use. It expects your application is based on the [CRM skeleton](https://github.com/remp2020/crm-skeleton)provided by us.

Installing module
-----------------

[](#installing-module)

We recommend using Composer for installation and update management.

```
composer require remp/crm-subscriptions-module
```

Enabling module
---------------

[](#enabling-module)

Add installed extension to your `app/config/config.neon` file.

```
extensions:
	- Crm\SubscriptionsModule\DI\SubscriptionsModuleExtension
```

Widgets
-------

[](#widgets)

Widgets are small reusable components that can be used on different places within CRM. Module can provide widget placeholders for other modules to populate or widget implementations.

### Available widgets

[](#available-widgets)

#### `SubscribersWithMissingAddressWidget`

[](#subscriberswithmissingaddresswidget)

[![Subscribers with missing address widget](docs/subscribers_with_missing_address_widget.png)](docs/subscribers_with_missing_address_widget.png)

Widget displays list of all subscribers with specified content access that don't have specified address type entered in the system. It is placed at the `admin.payments.top` placeholder, above the payments listing.

By default the widget displays all `print` subscribers without `print` address type entered. You can change the configuration in your `config.local.neon` and check different content access names against different address types:

```
subscribersWithMissingAddressWidget:
    setup:
        - setContentAccessNames(print, print_friday)
        - setAddressTypes(print, print_other)
```

### Available placeholders

[](#available-placeholders)

These are widget placeholders provided by Payments Module. You can register your own widgets to be displayed at following places:

- `admin.payments.top`
- `payments.banktransfer.right`
- `payments.admin.payment_source_listing`
- `payments.admin.payment_item_listing`
- `payments.frontend.payments_my.top`
- `payments.arpu.bottom`

API documentation
-----------------

[](#api-documentation)

All examples use `http://crm.press` as a base domain. Please change the host to the one you use before executing the examples.

All examples use `XXX` as a default value for authorization token, please replace it with the real tokens:

- *API tokens.* Standard API keys for server-server communication. It identifies the calling application as a whole. They can be generated in CRM Admin (`/api/api-tokens-admin/`) and each API key has to be whitelisted to access specific API endpoints. By default the API key has access to no endpoint.
- *User tokens.* Generated for each user during the login process, token identify single user when communicating between different parts of the system. The token can be read:
    - From `n_token` cookie if the user was logged in via CRM.
    - From the response of [`/api/v1/users/login` endpoint](https://github.com/remp2020/crm-users-module#post-apiv1userslogin) - you're free to store the response into your own cookie/local storage/session.

API responses can contain following HTTP codes:

ValueDescription200 OKSuccessful response, default value400 Bad RequestInvalid request (missing required parameters)403 ForbiddenThe authorization failed (provided token was not valid)404 Not foundReferenced resource wasn't foundIf possible, the response includes `application/json` encoded payload with message explaining the error further.

---

#### GET `/api/v1/users/subscriptions`

[](#get-apiv1userssubscriptions)

Returns all user subscriptions with information when they start/end and which content type they give an access to.

##### *Headers:*

[](#headers)

NameValueRequiredDescriptionAuthorizationBearer *String*yesUser token.##### *Params:*

[](#params)

NameValueRequiredDescriptionshow\_finished*Boolean*noFlag indicating whether to include finished subscriptions or not. If not provided, only active and future subscriptions are returned.##### *Example:*

[](#example)

```
curl -X POST \
  http://crm.press/api/v1/users/subscriptions \
  -H 'Authorization: Bearer XXX' \
  -H 'Content-Type: application/x-www-form-urlencoded'
```

Response:

```
{
    "status": "ok",
    "subscriptions": [ // Array; list of subscriptions
        {
            "start_at": "2019-01-15T00:00:00+01:00", // String; RFC3339 encoded start time
            "end_at": "2020-01-15T00:00:00+01:00", // String; RFC3339 encoded end time
            "code": "web_year", // String; subscription code (slug)
            "access": [ // Array: list of all types of content subscription includes
                "web" // String; name of the content type
            ],
            "name": "Web year subscription type",
            "user_label": "Web year",
        },
        {
            "start_at": "2019-03-05T00:00:00+01:00",
            "end_at": "2019-03-19T00:00:00+01:00",
            "code": "mobile-welcome-action",
            "access": [
                "web",
                "mobile"
            ],
            "name": "Web year subscription type with mobile access",
            "user_label": "Web & Mobile",
        }
    ]
}
```

---

#### POST `/api/v1/subscriptions/create`

[](#post-apiv1subscriptionscreate)

Creates new subscription for given user and returns new instance.

##### *Headers:*

[](#headers-1)

NameValueRequiredDescriptionAuthorizationBearer *String*yesBearer token.##### *Params:*

[](#params-1)

NameValueRequiredDescriptionemail*String*yesEmail of existing user.subscription\_type\_id*String*noID of subscription type to use. List of all subscription types is available at `/subscriptions/subscription-types-admin`. Either `subscription_type_id` or `subscription_type_code` must be filled.subscription\_type\_code*String*noCode of subscription type to use. List of all subscription types is available at `/subscriptions/subscription-types-admin`. Either `subscription_type_id` or `subscription_type_code` must be filled.is\_paid*Boolean*yesThe identification of paid subscriptions.start\_time*String*noRFC3339 formatted start time. If not present, subscription will start immediately.end\_time*String*noRFC3339 formatted end time. If not present, end time will set based on subscription type.type*String*yesType of subscription - values allowed: `regular`, `free`, `donation`, `gift`, `special`, `upgrade`, `prepaid`. If not provided, defaults to `regular`.##### *Example:*

[](#example-1)

```
curl -X POST \
  http://crm.press/api/v1/subscriptions/create \
  -H 'Authorization: Bearer XXX' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'email=user%40user.sk&subscription_type_id=73&is_paid=true'
```

Response:

```
{
    "status": "ok",
    "message": "Subscription created",
    "subscriptions": {
        "id": 628893, // string; ID of new subscription
        "start_time": "2019-03-08T13:35:05+01:00", // String; RFC3339 formatted start time of subscription
        "end_time": "2019-05-09T13:35:05+02:00" // String; RFC3339 formatted end time of subscription
    }
}
```

---

#### POST `/api/v1/subscriptions/update`

[](#post-apiv1subscriptionsupdate)

Update subscription based on sent parameters.

##### *Headers:*

[](#headers-2)

NameValueRequiredDescriptionAuthorizationBearer *String*yesBearer token.##### *Params:*

[](#params-2)

NameValueRequiredDescriptionid*String*yesEmail of existing user.subscription\_type\_id*String*noID of subscription type to use. List of all subscription types is available at `/subscriptions/subscription-types-admin`.is\_paid*Boolean*noThe identification of paid subscriptions.start\_time*String*noRFC3339 formatted start time. If not present, subscription will start immediately.end\_time*String*noRFC3339 formatted end time. If not present, end time will set based on subscription type.type*String*noType of subscription - values allowed: `regular`, `free`, `donation`, `gift`, `special`, `upgrade`, `prepaid`. If not provided, defaults to `regular`.##### *Example:*

[](#example-2)

```
curl -X POST \
  http://crm.press/api/v1/subscriptions/update \
  -H 'Authorization: Bearer XXX' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'id=12345&subscription_type_id=73&is_paid=true'
```

Response:

```
{
    "status": "ok",
    "message": "Subscription updated",
    "subscriptions": {
        "id": 628893, // string; ID of subscription
        "start_time": "2019-03-08T13:35:05+01:00", // String; RFC3339 formatted start time of subscription
        "end_time": "2019-05-09T13:35:05+02:00" // String; RFC3339 formatted end time of subscription
    }
}
```

Components
----------

[](#components)

**ActualSubscribersRegistrationSourceStatsWidget**

Admin dashboard stats graph widget.

[![alt text](docs/registration_source_active_subscription.png "ActualSubscribersRegistrationSourceStatsWidget")](docs/registration_source_active_subscription.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/ActualSubscribersRegistrationSourceStatsWidget/ActualSubscribersRegistrationSourceStatsWidget.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/SubscriptionsModule.php#L123)

**ActualSubscribersStatWidget**

Admin dashboard stats widget.

[![alt text](docs/active_subscribers.png "ActualSubscribersStatWidget")](docs/active_subscribers.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/ActualSubscribersStatWidget/ActualSubscribersStatWidget.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/SubscriptionsModule.php#L118)

**ActualSubscriptionLabel**

Admin user listing component.

[![alt text](docs/actual_subscription.png "ActualSubscriptionLabel")](docs/actual_subscription.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/ActualSubscriptionLabel/ActualSubscriptionLabel.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/SubscriptionsModule.php#L163)

**ActualSubscriptionsStatWidget**

Admin dashboard actual subscriptions count widget.

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/ActualSubscriptionsStatWidget/ActualSubscriptionsStatWidget.php#L1)

**ActualUserSubscriptions**

Admin user detail stats widget.

[![alt text](docs/user_actual_subscriptions.png "ActualUserSubscriptions")](docs/user_actual_subscriptions.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/ActualUserSubscriptions/ActualUserSubscriptions.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/SubscriptionsModule.php#L108)

**EndingSubscriptionsWidget**

Admin ending subscriptions listing widget.

[![alt text](docs/ending_subscriptions.png "EndingSubscriptionsWidget")](docs/ending_subscriptions.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/EndingSubscriptionsWidget/EndingSubscriptionsWidget.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/SubscriptionsModule.php#L143)

**MonthSubscriptionsSmallBarGraphWidget**

Admin users header graph widget.

[![alt text](docs/subscriptions_graph.png "MonthSubscriptionsSmallBarGraphWidget")](docs/subscriptions_graph.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/MonthSubscriptionsSmallBarGraphWidget/MonthSubscriptionsSmallBarGraphWidget.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/SubscriptionsModule.php#L158)

**MonthSubscriptionStatWidget**

Admin dashboard single stat widget.

[![alt text](docs/new_subscriptions.png "MonthSubscriptionStatWidget")](docs/new_subscriptions.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/MonthSubscriptionStatWidget/MonthSubscriptionsStatWidget.php#L1)

**MonthToDateSubscriptionStatWidget**

Admin dashboard single stat widget.

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/MonthToDateSubscriptionStatWidget/MonthToDateSubscriptionsStatWidget.php#L1)

**PrintSubscribersWithoutPrintAddressWidget**

Admin payments listing header widget.

[![alt text](docs/subscribers_with_missing_address.png "PrintSubscribersWithoutPrintAddressWidget")](docs/subscribers_with_missing_address.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/PrintSubscribersWithoutPrintAddressWidget/SubscribersWithMissingAddressWidget.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/SubscriptionsModule.php#L168)

**RenewedSubscriptionsEndingWithinPeriodWidget**

Admin dashboard stats widget.

[![alt text](docs/ending_subscriptions_1.png "RenewedSubscriptionsEndingWithinPeriodWidget")](docs/ending_subscriptions_1.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/RenewedSubscriptionsEndingWithinPeriodWidget/RenewedSubscriptionsEndingWithinPeriodWidget.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/SubscriptionsModule.php#L153)

**SubscriptionButton**

Admin listing edit subscription button widget.

[![alt text](docs/edit_subscription_btn.png "SubscriptionButton")](docs/edit_subscription_btn.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/SubscriptionButton/SubscriptionButton.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/SubscriptionsModule.php#L103)

**SubscriptionEndsStats**

Admin ending subscriptions types and content access listing component.

[![alt text](docs/ending_subscriptions_table.png "SubscriptionEndsStats")](docs/ending_subscriptions_table.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/SubscriptionEndsStats/SubscriptionEndsStats.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/presenters/DashboardPresenter.php#L237)

**SubscriptionsEndingWithinPeriodWidget**

Admin dashboard ending subscriptions stats widget.

[![alt text](docs/ending_within_period.png "SubscriptionsEndingWithinPeriodWidget")](docs/ending_within_period.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/SubscriptionsEndingWithinPeriodWidget/SubscriptionsEndingWithinPeriodWidget.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/SubscriptionsModule.php#L148)

**TodaySubscriptionsStatWidget**

Admin dashboard single stat widget.

[![alt text](docs/new_subscriptions_today.png "TodaySubscriptionsStatWidget")](docs/new_subscriptions_today.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/TodaySubscriptionsStatWidget/TodaySubscriptionsStatWidget.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/SubscriptionsModule.php#L128)

**TotalSubscriptionsStatWidget**

Admin dashboard single stat widget.

[![alt text](docs/total_subscriptions.png "TotalSubscriptionsStatWidget")](docs/total_subscriptions.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/TotalSubscriptionsStatWidget/TotalSubscriptionsStatWidget.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/SubscriptionsModule.php#L113)

**UserSubscriptions**

Admin user detail subscriptions listing widget.

[![alt text](docs/user_subscriptions.png "UserSubscriptions")](docs/user_subscriptions.png)

[Source code](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/components/UserSubscriptions/UserSubscriptionsListing.php#L1)

[How to use](https://github.com/remp2020/crm-subscriptions-module/blob/7f5c0f97ad3b0effc0d49326fb35dabcad300d98/src/SubscriptionsModule.php#L98)

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance72

Regular maintenance activity

Popularity31

Limited adoption so far

Community30

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~28 days

Recently: every ~50 days

Total

94

Last Release

161d ago

Major Versions

0.39.0 → 1.0.02022-03-30

1.2.0 → 2.0.02022-08-25

2.11.0 → 3.0.02024-01-22

2.11.1 → 3.2.02024-05-09

3.7.0 → 4.0.02025-04-02

PHP version history (5 changes)0.1.1PHP ^7.1

0.29.0PHP ^7.3

0.35.0PHP ^7.4

2.0.0PHP ^8.0

3.0.0PHP ^8.1

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/a05541c0b35f43d95db5342210e1d9e64242888812d13f5b096df48b6aabd863?d=identicon)[msvitok](/maintainers/msvitok)

![](https://www.gravatar.com/avatar/2c30fdbc85cda35b94f7f59399918193a0289152281abcef344ec9ee82864177?d=identicon)[markoph](/maintainers/markoph)

---

Top Contributors

[![rootpd](https://avatars.githubusercontent.com/u/812909?v=4)](https://github.com/rootpd "rootpd (177 commits)")[![markoph](https://avatars.githubusercontent.com/u/6843562?v=4)](https://github.com/markoph "markoph (148 commits)")[![miroc](https://avatars.githubusercontent.com/u/1230714?v=4)](https://github.com/miroc "miroc (96 commits)")[![zoldia](https://avatars.githubusercontent.com/u/1526070?v=4)](https://github.com/zoldia "zoldia (54 commits)")[![tomaj](https://avatars.githubusercontent.com/u/446736?v=4)](https://github.com/tomaj "tomaj (44 commits)")[![Matefko](https://avatars.githubusercontent.com/u/22897457?v=4)](https://github.com/Matefko "Matefko (25 commits)")[![lubos-michalik](https://avatars.githubusercontent.com/u/63700066?v=4)](https://github.com/lubos-michalik "lubos-michalik (25 commits)")[![burithetech](https://avatars.githubusercontent.com/u/3502143?v=4)](https://github.com/burithetech "burithetech (13 commits)")[![davidkvasnovsky](https://avatars.githubusercontent.com/u/12381721?v=4)](https://github.com/davidkvasnovsky "davidkvasnovsky (5 commits)")[![ricco24](https://avatars.githubusercontent.com/u/1409647?v=4)](https://github.com/ricco24 "ricco24 (3 commits)")[![nakashu](https://avatars.githubusercontent.com/u/1550659?v=4)](https://github.com/nakashu "nakashu (3 commits)")[![Brezak](https://avatars.githubusercontent.com/u/59848927?v=4)](https://github.com/Brezak "Brezak (2 commits)")[![mmacsodi-fcm](https://avatars.githubusercontent.com/u/169140294?v=4)](https://github.com/mmacsodi-fcm "mmacsodi-fcm (2 commits)")[![strstensky](https://avatars.githubusercontent.com/u/39539367?v=4)](https://github.com/strstensky "strstensky (2 commits)")[![weblate](https://avatars.githubusercontent.com/u/1607653?v=4)](https://github.com/weblate "weblate (2 commits)")[![mattusik](https://avatars.githubusercontent.com/u/1252223?v=4)](https://github.com/mattusik "mattusik (1 commits)")[![mikoczy](https://avatars.githubusercontent.com/u/14105084?v=4)](https://github.com/mikoczy "mikoczy (1 commits)")[![lulco](https://avatars.githubusercontent.com/u/9377319?v=4)](https://github.com/lulco "lulco (1 commits)")

### Embed Badge

![Health badge](/badges/remp-crm-subscriptions-module/health.svg)

```
[![Health](https://phpackages.com/badges/remp-crm-subscriptions-module/health.svg)](https://phpackages.com/packages/remp-crm-subscriptions-module)
```

PHPackages © 2026

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