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.
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.
If you run the command without options, it will ask you for:
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.[!WARNING] By default, if the login is
admin, the password defaults toadmin. Never use the defaultadmin/admincredentials in a production environment.
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.
--password option and the login is "admin", the default password will be "admin".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.
How can I help you explore Laravel packages today?