PHPackages                             bolt/users - 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. bolt/users

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

bolt/users
==========

Bolt 4 Users Extension

0.2.2(3y ago)835.3k7[9 issues](https://github.com/bolt/users/issues)MITPHPPHP &gt;=7.1.3CI failing

Since Jul 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/bolt/users)[ Packagist](https://packagist.org/packages/bolt/users)[ RSS](/packages/bolt-users/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (5)Versions (13)Used By (0)

Bolt Users Extension
====================

[](#bolt-users-extension)

The Bolt users extension allows you to add front-end users to your website.

Here is a list of things that the extension allows:

- Define groups of users, allow them to register and login
- Limit ContentTypes (pages) to be visible only by users belonging to a certain group
- Define user fields and allow them to edit their own profile

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

[](#installation)

To install this extension, simply run the following terminal command from your root folder:

```
composer require bolt/users

```

Basic usage
-----------

[](#basic-usage)

To limit a ContentType to a specific group of users, say `ROLE_MEMBER`, do the following:

1. Define your user group in `config/extensions/bolt-usersextension.yaml`:

```
groups:
  ROLE_MEMBER:
    redirect_on_register: homepage # Provide either a route name, or a URL
    redirect_on_login: / # Provide either a route name, or a URL
    initial_status: enabled # Once a user registers, he/she is automatically allowed to login
```

2. Limit the access to a certain ContentType, e.g. `entries` to that user group in `config/contenttypes.yaml`:

```
entries:
    name: Entries
    singular_name: Entry
    fields:
        # ... normal ContentType definition
    allow_for_groups: [ 'ROLE_MEMBER', 'ROLE_ADMIN' ]
```

Note: The `allow_for_groups` option is used to limit access to the ContentType (listing as well as record pages). It will only allow users who are logged in and have the correct permission to access those pages. Not even admins will be allowed to view those pages, hence why we add the `ROLE_ADMIN` group to ensure admins have view rights too.

3. Allow users to register and to login

The extension allows you to include a registration form on any twig template. To add a registration form, just add the following to your twig file:

```
    {{ registration_form(group='ROLE_MEMBER') }}
```

This line below will render a registration form with username, password and email fields for the user to fill in. You must always specify the user group to which this form applies (in this case, `ROLE_MEMBER`). Users who register with that group will automatically receive access rights to ContentTypes limited to that group.

Currently, the `registration_form` function accepts the following options:

Option nameDescriptionRequired / optionalgroupThe group for the registering user. Must match a group defined in the extension config.requiredwithlabelsIf true, the `label` fields for each input will be included. Default is true.optionallabelsAn array used to override default labels. The key is the field name, e.g. `username` and the value is the label to be used.optionalTo render the login form, use the following:

```
    {{ login_form() }}
```

The login function does not specify the group. The extension will try to authenticate the user with his/her credentials, and assign the correct group to that user. The `login_form`function accepts two optional arguments, `withlabels` and `labels` which work the same way as they do for the `registration_form` function.

User profiles
-------------

[](#user-profiles)

Sometimes, you want to do more with users than simply restrict access to certain pages. The extension allows you to define custom user fields by linking a ContentType to a user group.

For example, to define a date of birth to our 'ROLE\_MEMBER' group, we would do the following:

1. Define a `members` ContentType in `config/contenttypes.ymal` that will be used to store information about users.

```
members:
    name: Members
    singular_name: Member
    title_format: "{author.username}"
    fields:
      dob:
        type: date
    viewless: true
```

Then, edit the extension config in `config/bolt-usersextension.yaml`:

```
groups:
  ROLE_MEMBER:
    redirect_on_register: homepage
    redirect_on_login: /
    initial_status: enabled
    contenttype: members # Link the 'members' ContentType to the 'ROLE_MEMBER' group.
```

Now, users belonging to the `ROLE_MEMBER` group will be able to access their profile at `/profile`. You can customize the appearance of this page by customizing the record template for the members ContentType.

2. Optionally, you may wish to allow members to edit their profiles. To do this, add the following to the config:

```
groups:
  ROLE_MEMBER:
    redirect_on_register: homepage
    redirect_on_login: /
    initial_status: enabled
    contenttype: members
    allow_profile_edit: true # If true, members will be able to edit their profiels on /profile/edit . You must specify the edit template below
    profile_edit_template: 'edit_profile.twig'
```

In this case, the `edit_profile.twig` file, located in the `public/theme/your-theme/` directory, may contain any regular twig template. Here is a basic example of the edit form that you can include:

```

    {% for field in record.fields %}

        {% if field.type === 'text' %}

        {% elseif field.type === 'textarea' %}
            {{ field.parsedValue }}
        {% elseif field.type === 'checkbox' %}

        {% elseif field.type === 'date' %}

        {% endif %}
    {% endfor %}

```

Customizing the register and login form appearance
--------------------------------------------------

[](#customizing-the-register-and-login-form-appearance)

If the customization options available in the `registration_form` and `login_form`functions are not enough, you may wish to use the following functions:

For registration:

FunctionDescription`registration_form_username`Renders the username field`registration_form_password`Renders the password field`registration_form_email`Renders the email field`registration_form_group`Renders a hidden field for the user's group.`registration_form_csrf`Renders a hidden field that contains a CSRF token.`registration_form_submit`Renders the submit button---

For logging in:

FunctionDescription`login_form_username`Renders the username field`login_form_password`Renders the password field`login_form_csrf`Renders a hidden field that contains a CSRF token.`login_form_submit`Renders the submit button`login_redirect_url`redirect to "/" after submitEach field function above takes an optional `withlabel` argument and the `labels` argument that is also used by `registration_form`.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.8% 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 ~78 days

Recently: every ~127 days

Total

11

Last Release

1384d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1835343?v=4)[Bob van de Vijver](/maintainers/bobvandevijver)[@bobvandevijver](https://github.com/bobvandevijver)

![](https://avatars.githubusercontent.com/u/3901745?v=4)[Tobias Feijten](/maintainers/tobias-93)[@tobias-93](https://github.com/tobias-93)

![](https://avatars.githubusercontent.com/u/1833361?v=4)[Bob den Otter](/maintainers/bobdenotter)[@bobdenotter](https://github.com/bobdenotter)

---

Top Contributors

[![I-Valchev](https://avatars.githubusercontent.com/u/7093518?v=4)](https://github.com/I-Valchev "I-Valchev (29 commits)")[![bobdenotter](https://avatars.githubusercontent.com/u/1833361?v=4)](https://github.com/bobdenotter "bobdenotter (11 commits)")[![crim3hound](https://avatars.githubusercontent.com/u/29301735?v=4)](https://github.com/crim3hound "crim3hound (8 commits)")[![fatguytyson](https://avatars.githubusercontent.com/u/14961127?v=4)](https://github.com/fatguytyson "fatguytyson (3 commits)")[![oportier](https://avatars.githubusercontent.com/u/409996?v=4)](https://github.com/oportier "oportier (2 commits)")[![Rvey](https://avatars.githubusercontent.com/u/17904874?v=4)](https://github.com/Rvey "Rvey (2 commits)")[![jurjenvn](https://avatars.githubusercontent.com/u/5080526?v=4)](https://github.com/jurjenvn "jurjenvn (1 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bolt-users/health.svg)

```
[![Health](https://phpackages.com/badges/bolt-users/health.svg)](https://phpackages.com/packages/bolt-users)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)

PHPackages © 2026

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