Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Admin Bundle Laravel Package

aropixel/admin-bundle

View on GitHub
Deep Wiki
Context7

Create Admin User (aropixel:admin:create-user)

The AropixelAdminBundle provides a command to quickly create a new administrative user for your application. This user is automatically assigned the ROLE_SUPER_ADMIN role.

Usage

To create a new admin user, run the following command:

php bin/console aropixel:admin:create-user

The command can be run in interactive mode or by providing options.

Interactive Mode

If you run the command without options, it will ask you for:

  1. Email: The email address of the new administrator.
  2. First Name: The administrator's first name.
  3. Last Name: The administrator's last name.

Using Options

You can also provide the information directly via command-line options:

php bin/console aropixel:admin:create-user --login=admin@example.com --first_name=John --last_name=Doe --password=secret

Available options:

  • --login: The user's email address.
  • --first_name: The user's first name.
  • --last_name: The user's last name.
  • --password: (Optional) The user's password.

Behavior

[!WARNING] By default, if the login is admin, the password defaults to admin. Never use the default admin/admin credentials in a production environment.

Non-Interactive Mode

When running the command in non-interactive mode (e.g., in a CI/CD pipeline or setup script with --no-interaction), you must provide the required options (--login, --first_name, --last_name, --password).

Special case for Development: In the dev environment (where APP_ENV=dev), you can run the command without any options in non-interactive mode to create a default admin/admin account:

# Works only in dev environment
php bin/console aropixel:admin:create-user --no-interaction

In any other environment (e.g., prod), the command will fail if you try to use the default admin/admin credentials in non-interactive mode, as a security measure.

Activation Email

  • If the login provided is not "admin", the command will attempt to send an activation email to the user so they can set their own password and activate their account.
  • If the login is "admin", the account is automatically enabled and initialized.

Password

  • If you don't provide a password via the --password option and the login is "admin", the default password will be "admin".
  • If you provide a login other than "admin" and don't provide a password, the user will need to set it via the activation email.

Validation

The command validates the email format and ensures that required fields (First Name, Last Name) are not empty. It also checks if a user with the same email already exists in the database.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware