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.

v2.0.0(today)00MITPHPPHP ^8.3

Since Jun 20Pushed todayCompare

[ 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 today

READMEChangelog (4)Dependencies (1)Versions (3)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**: Easy-to-use admin interface for managing registration codes
- **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.

Usage
-----

[](#usage)

### Creating Registration Codes

[](#creating-registration-codes)

1. Navigate to the Admin panel
2. Go to Extensions → Registration Code
3. Enter a username and registration code
4. Click "Add" to create the code

### Importing Registration Codes

[](#importing-registration-codes)

1. Prepare a CSV file with the format: `username,code`
2. In the admin panel, click "Import CSV"
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. In the admin panel, click "Export CSV"
2. 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)

### 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).

Changelog
---------

[](#changelog)

### 2.0.4

[](#204)

- Implemented custom admin page using ExtensionPage for Flarum v2 compatibility
- Updated admin extend.ts to use Admin.page() method
- Added RegistrationCodePage component extending ExtensionPage

### 2.0.3

[](#203)

- Added TypeScript configuration for frontend development
- Rebuilt frontend files with TypeScript support

### 2.0.2

[](#202)

- Fixed admin settings initialization for Flarum v2 compatibility
- Updated admin extend.ts to use Extend.Admin() API
- Updated admin index.ts to properly export extend module

### 2.0.1

[](#201)

- Fixed YAML parsing error in locale files
- Quoted values containing colons in en.yml and zh-Hans.yml

### 2.0.0

[](#200)

- Updated for Flarum v2 compatibility
- Updated PHP requirement to 8.3+
- Updated to use new ApiResource extender instead of deprecated ApiSerializer
- Updated model to use $casts instead of $dates for Laravel 13 compatibility
- Updated webpack configuration for Flarum v2
- Updated admin settings API for Flarum v2

### 1.0.0

[](#100)

- Initial release
- Basic registration code management
- CSV import/export functionality
- Admin interface
- User registration validation

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

2

Last Release

0d 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 (12 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.

12127.5k](/packages/flarum-lang-russian)[fof/oauth

Allow users to log in with GitHub, Facebook, Google, Discord, GitLab, LinkedIn, and more!

50131.1k45](/packages/fof-oauth)[maicol07/flarum-ext-sso

SSO for Flarum

468.7k](/packages/maicol07-flarum-ext-sso)[flarum-lang/french

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

1936.5k](/packages/flarum-lang-french)[flarum/flags

Allow users to flag posts for moderator review.

11490.7k27](/packages/flarum-flags)[flarum/approval

Make discussions and posts require moderator approval.

11449.8k37](/packages/flarum-approval)

PHPackages © 2026

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