PHPackages                             mattoid/flarum-ext-store - 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. mattoid/flarum-ext-store

ActiveFlarum-extension

mattoid/flarum-ext-store
========================

flarum-ext-store

1.2.3.2(4mo ago)24.1k43LPL-1.02PHPCI failing

Since Jul 1Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/Mattoids/flarum-ext-store)[ Packagist](https://packagist.org/packages/mattoid/flarum-ext-store)[ RSS](/packages/mattoid-flarum-ext-store/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (26)Used By (3)

Flarum-ext-store
================

[](#flarum-ext-store)

[![GitHub license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://raw.githubusercontent.com/Mattoids/flarum-ext-store/master/LICENSE.md) [![Latest Stable Version](https://camo.githubusercontent.com/cc06943592fedfd6fd70b9326efc978b2db5c497b0a964d0b1f5245ee62ef878/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6174746f69642f666c6172756d2d6578742d73746f72652e737667)](https://packagist.org/packages/mattoid/flarum-ext-store) [![Total Downloads](https://camo.githubusercontent.com/42503ca8ca0f0b0f4ab0b79efa9b1c75b2fb1bb6b4de1282352f81248540d283/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6174746f69642f666c6172756d2d6578742d73746f72652e737667)](https://packagist.org/packages/mattoid/flarum-ext-store)

A [Flarum](http://flarum.org) extension. store

[中文](https://github.com/Mattoids/flarum-ext-store/blob/master/docs/readme_cn.md)

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

[](#installation)

Install with composer:

```
composer require mattoid/flarum-ext-store:"*"
```

Updating
--------

[](#updating)

```
composer update mattoid/flarum-ext-store:"*"
php flarum migrate
php flarum cache:clear
```

Help
----

[](#help)

### Register Product Events

[](#register-product-events)

```
(new StoreExtend('Unique KEY of the product, must not overlap with other extensions'))
  // Register product information
  ->addStoreGoods(Goods::class)
  // Register pre-validation
  ->addValidate(Validate::class)
  // Register business logic of the product
  ->addAfter(After::class)
  // Product invalidation logic
  ->addInvalid(Invalid::class)
  // Product usage logic
  ->addEnable(Enable::class);
```

### Product Events Overview

[](#product-events-overview)

- Executed before purchase

    When a user clicks the purchase button, `Mattoid\Store\Goods\Validate` is executed first. If validation of user-submitted forms or user permission for the product is required, this class needs to be overridden.
- Executed after purchase

    After a user clicks the purchase button, this plugin automatically verifies user funds, product purchase permissions, etc. Upon confirmation, `Mattoid\Store\Goods\After` class is executed.

    An event `Mattoid\Store\Event\StoreBuyEvent` is triggered after the operation completes.
- Executed when product becomes invalid (payment failure)

    Use the `php flarum schedule:run` command to periodically check for invalid products. If the product has automatic payment deduction enabled, only deduction (without inventory operations) occurs. If automatic deduction is not enabled or fails, `Mattoid\Store\Goods\Invalid` class is executed.

    An event `Mattoid\Store\Event\StoreInvalidEvent` is triggered after the operation completes.
- Product Information

    Register product information (displayed on the admin's add product page) by overriding and registering the `Mattoid\Store\Goods\Goods` class.
- Use Product
- Register product usage logic, add `use/cancel` buttons on the shopping cart interface, and notify product processing events when the user clicks the button.

Event Introduction
------------------

[](#event-introduction)

All events are not transaction-managed; they notify other plugins before code execution ends without interception or similar processing. For transactional atomicity, use `Mattoid\Store\Extend\StoreExtend` class for registration, treating all capabilities registered by this class as proprietary business logic of this plugin. (For example: If funds are insufficient, `Mattoid\Store\Event\StoreBuyEvent` and subsequent logic of `Mattoid\Store\Goods\After` are not executed; refund and inventory increase occur automatically if `Mattoid\Store\Goods\After` execution fails.)

Events typically do not require special handling by product plugins. This plugin recommends using `Mattoid\Store\Extend\StoreExtend` class for business logic registration.

### Purchase Failure Event

[](#purchase-failure-event)

`Mattoid\Store\Event\StoreBuyFailEvent`

This event is listened to by this plugin. Notify this event if a rollback of purchase information is needed due to failed proprietary business logic execution by the product plugin. This plugin handles inventory and refund operations automatically. (Not needed if using `Mattoid\Store\Extend\StoreExtend` to register product business logic.)

### Purchase Notification Event

[](#purchase-notification-event)

`Mattoid\Store\Event\StoreBuyEvent`

This event is listened to by the product plugin itself to indicate the end of a purchase. Product plugins can perform post-purchase operations.

### Add to Cart

[](#add-to-cart)

`Mattoid\Store\Event\StoreCartAddEvent`

This event is listened to by this plugin. Product plugins can implement add to cart operations via this event (automatically deducting inventory).

### Edit Cart

[](#edit-cart)

`Mattoid\Store\Event\StoreCartEditEvent`

This event is listened to by this plugin. Product plugins can implement cart editing operations via this event (increasing inventory if `status` is greater than 1).

### Rollback Inventory

[](#rollback-inventory)

`Mattoid\Store\Event\StoreStockAddEvent`

This event is listened to by this plugin. Product plugins can implement inventory rollback operations via this event.

### Deduct Inventory

[](#deduct-inventory)

`Mattoid\Store\Event\StoreStockSubEvent`

This event is listened to by this plugin. Product plugins can implement inventory deduction operations via this event.

### Product Invalidation Event

[](#product-invalidation-event)

`Mattoid\Store\Event\StoreInvalidEvent`

This event is listened to by the product plugin and is triggered when a product becomes invalid (regardless of successful payment deduction).

### Product Plugins

[](#product-plugins)

- [Invitation Code (Audit Version)](https://github.com/Mattoids/flarum-ext-store-invite)
- [Check-in Card](https://github.com/Mattoids/flarum-ext-store-check-in)
- [Auto Check-in Card](https://github.com/Mattoids/flarum-ext-store-auto-check-in)

Links
-----

[](#links)

- [Packagist](https://packagist.org/packages/mattoid/flarum-ext-store)
- [GitHub](https://github.com/mattoids/flarum-ext-store)
- [Discuss](https://discuss.flarum.org/d/34793)

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance75

Regular maintenance activity

Popularity26

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98% 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 ~22 days

Recently: every ~112 days

Total

25

Last Release

139d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e4fda7a9900cbfbd6b1778d8c872b9e4d07d75bad09dd1254c1dac8d79a8c33?d=identicon)[mattoid](/maintainers/mattoid)

---

Top Contributors

[![liufei-ereach](https://avatars.githubusercontent.com/u/179955237?v=4)](https://github.com/liufei-ereach "liufei-ereach (100 commits)")[![huoxin233](https://avatars.githubusercontent.com/u/23447157?v=4)](https://github.com/huoxin233 "huoxin233 (1 commits)")[![Mattoids](https://avatars.githubusercontent.com/u/16252517?v=4)](https://github.com/Mattoids "Mattoids (1 commits)")

---

Tags

flarum

### Embed Badge

![Health badge](/badges/mattoid-flarum-ext-store/health.svg)

```
[![Health](https://phpackages.com/badges/mattoid-flarum-ext-store/health.svg)](https://phpackages.com/packages/mattoid-flarum-ext-store)
```

###  Alternatives

[fof/upload

The file upload extension for the Flarum forum with insane intelligence.

188171.7k15](/packages/fof-upload)[fof/byobu

Well integrated, advanced private discussions.

61105.8k9](/packages/fof-byobu)[fof/gamification

Upvotes and downvotes for your Flarum community

4157.1k6](/packages/fof-gamification)[fof/user-bio

Add a user bio to user profiles

2196.5k9](/packages/fof-user-bio)[flarum-lang/russian

Russian language pack for Flarum.

13126.1k](/packages/flarum-lang-russian)[fof/drafts

Allow users to create post and discussion drafts

1771.1k5](/packages/fof-drafts)

PHPackages © 2026

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