PHPackages                             zephyrisle/flarum-registration-code - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. zephyrisle/flarum-registration-code

ActiveFlarum-extension[Authentication &amp; Authorization](/categories/authentication)

zephyrisle/flarum-registration-code
===================================

Registration code management for Flarum.

2.1.1(1mo ago)021MITPHPPHP ^8.3

Since Jun 20Pushed 1mo agoCompare

[ Source](https://github.com/Zephyr-Isle/flarum-registration-code)[ Packagist](https://packagist.org/packages/zephyrisle/flarum-registration-code)[ RSS](/packages/zephyrisle-flarum-registration-code/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (2)Versions (28)Used By (0)

zephyrisle/flarum-registration-code
===================================

[](#zephyrisleflarum-registration-code)

A Flarum extension that enforces one-time registration codes mapped to usernames. This extension provides a secure way to control user registration by requiring pre-assigned registration codes that are linked to specific usernames.

Features
--------

[](#features)

- **Secure Registration Control**: Require a valid registration code for new user sign-ups
- **Username Mapping**: Each registration code is linked to a specific username for precise access control
- **Admin Management**: Manage registration codes directly from the extension's default admin page
- **CSV Import/Export**: Bulk import and export registration codes via CSV format
- **One-Time Use**: Each code can only be used once, preventing re-registration
- **Usage Tracking**: Track which codes have been used, by whom, and when
- **Auto-Email Generation**: Automatically generates email addresses based on username and forum domain

Requirements
------------

[](#requirements)

- Flarum ^2.0
- PHP 8.3 or higher
- MySQL 8.0 or higher / MariaDB 10.6 or higher

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

[](#installation)

Install via composer:

```
composer require zephyrisle/flarum-registration-code
```

Then enable the extension in the Flarum admin panel.

Admin Dashboard
---------------

[](#admin-dashboard)

The admin UI follows Flarum 2's default extension page pattern:

- Use the built-in extension page to configure and manage the extension
- Toggle the `Enable registration code requirement` setting from the extension page
- Create, import, export, refresh, and delete registration codes from the same page
- Keep the management UI on the standard extension page for better compatibility with Flarum's admin dashboard

Usage
-----

[](#usage)

### Creating Registration Codes

[](#creating-registration-codes)

1. Navigate to the Admin panel
2. Open Extensions
3. Open the Registration Code extension page
4. Turn on `Enable registration code requirement` if you want to enforce code validation during sign-up
5. Enter a username and registration code
6. Click `Add` to create the code

### Importing Registration Codes

[](#importing-registration-codes)

1. Prepare a CSV file with the format: `username,code`
2. Open the Registration Code extension page in Admin
3. Either paste the CSV content or upload a CSV file
4. Click `Import` to process the codes

Example CSV format:

```
username,code
alice,ALICE-001
bob,BOB-001
charlie,CHARLIE-001

```

### Exporting Registration Codes

[](#exporting-registration-codes)

1. Open the Registration Code extension page in Admin
2. Click `Export CSV`
3. The browser will download a CSV file containing all registration codes

### User Registration

[](#user-registration)

Users must provide a valid registration code during sign-up:

- The code must exist in the system
- The code must not have been used before
- The code must match the username they're registering with
- The username must not already exist in the system

Security Features
-----------------

[](#security-features)

- **Race Condition Protection**: Uses database locking to prevent concurrent use of the same code
- **Username Validation**: Prevents assigning codes to usernames that already exist
- **Foreign Key Constraints**: Ensures data integrity between registration codes and users
- **Admin-Only Access**: All management operations require admin privileges

Database Schema
---------------

[](#database-schema)

The extension creates the following database changes:

### registration\_codes table

[](#registration_codes-table)

- `id` - Primary key
- `username` - The username this code is assigned to (indexed)
- `code` - The registration code (unique)
- `used_by` - Foreign key to users table (nullable, indexed)
- `used_at` - Timestamp when the code was used (nullable)
- `created_at` - Creation timestamp
- `updated_at` - Last update timestamp

### users table

[](#users-table)

- `registration_code` - Stores the registration code used during registration (nullable)

Development
-----------

[](#development)

The admin frontend follows Flarum 2's `Extend.Admin().setting(...)` pattern. The registration code manager is rendered as a custom block on the default extension page instead of a separate custom admin route.

### Setup

[](#setup)

```
composer install
cd js
npm install
npm run build
```

### Building for Production

[](#building-for-production)

```
cd js
npm run build
```

### Development Mode

[](#development-mode)

```
cd js
npm run dev
```

License
-------

[](#license)

MIT License

Support
-------

[](#support)

For issues, feature requests, or contributions, please visit the [GitHub repository](https://github.com/Zephyr-Isle/flarum-registration-code).

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance92

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

27

Last Release

37d ago

Major Versions

1.0.0 → v2.0.02026-06-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/ac5dcab64b681ca4252624f74d6a75ffe53795b48eb30710fba9c367b4aeb0d8?d=identicon)[Zephyr-Isle](/maintainers/Zephyr-Isle)

---

Top Contributors

[![Zephyr-Isle](https://avatars.githubusercontent.com/u/133970629?v=4)](https://github.com/Zephyr-Isle "Zephyr-Isle (36 commits)")

### Embed Badge

![Health badge](/badges/zephyrisle-flarum-registration-code/health.svg)

```
[![Health](https://phpackages.com/badges/zephyrisle-flarum-registration-code/health.svg)](https://phpackages.com/packages/zephyrisle-flarum-registration-code)
```

###  Alternatives

[flarum-lang/russian

Russian language pack for Flarum.

13129.1k](/packages/flarum-lang-russian)[flarum-lang/french

French language pack to localize the Flarum forum software plus its official and third-party extensions.

1941.0k](/packages/flarum-lang-french)[flarum-lang/german

German language pack for Flarum.

2153.3k](/packages/flarum-lang-german)[maicol07/flarum-ext-sso

SSO for Flarum

468.7k](/packages/maicol07-flarum-ext-sso)[spookygames/flarum-ext-auth-keycloak

Allow users to sign in/up/out with Keycloak.

181.5k](/packages/spookygames-flarum-ext-auth-keycloak)

PHPackages © 2026

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