Download the PHP package bolt/users without Composer

On this page you can find all versions of the php package bolt/users. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package users

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:

Installation

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

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:

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

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.

  1. 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:

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 name Description Required / optional
group The group for the registering user. Must match a group defined in the extension config. required
withlabels If true, the label fields for each input will be included. Default is true. optional
labels An array used to override default labels. The key is the field name, e.g. username and the value is the label to be used. optional

To render the login form, use the following:

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

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.

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

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.

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

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:

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:

Function Description
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:

Function Description
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 submit

Each field function above takes an optional withlabel argument and the labels argument that is also used by registration_form.


All versions of users with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.3
twig/twig Version ^2.12 | ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bolt/users contains the following files

Loading the files please wait ....