Download the PHP package luilliarcec/laravel-user-commands without Composer

On this page you can find all versions of the php package luilliarcec/laravel-user-commands. 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 laravel-user-commands

Laravel User Commands V3

run-tests Latest Version on Packagist Quality Score Total Downloads GitHub license

If like me, you have ever considered having commands to manipulate users within your application, this package will help you.

Installation

You can install the package via composer:

Now publish the configuration file into your app's config directory, by running the following command:

That is all. 😀

Usage

The package has 4 basic commands

Commands Description
user:create Create a new user in your app
user:reset-password Restore a user's password
user:delete Delete a user
user:restore Restore a user

Create Users

Fields

All the fields defined in your fillable property of your model will be used when executing the command. If you want to add more fields you can do it from your config file (your file takes precedence over your model, so if you define the fields in your config file the fields of your fillable property will be ignored)

Rules

Whether you have fields defined in your model or in the configuration file, the filled rule will be dynamically applied to those fields. If you want to add custom rules you can do it from the rules key from your configuration file, these will be merged in such a way that those fields that have not been given a custom rule will use the filled rule by default.

After all, you are free to extend the command and configure it to your liking.

or

If you want to mark the user's email as verified you can pass the argument --verified Ex.:

If your model uses roles and permissions, you must configure the model of the roles and permissions and the name of the relationships in the configuration file.

You can then pass the permissions or roles as arguments.

It should be noted that the roles and permissions
must already exist in your database and will be searched by the name field

Once the user has been created, the notification that it has been created will be sent if it implements the MustVerifyEmail interface and if the verification.verify route name exists

If you want to apply your own logic or just save default data for all users, you can extend the command and apply your necessary logic, or copy the prepareForSave method and add your necessary data. Ex.:

$this->data will contain the data of the user that was asked, if you want to access your data that you entered with the --attribute flag you can do it by calling the attributes function which will return a key => value array with your data.

Reset Password User

The command to reset password user receives the value parameter as required. It will be searched by email and if it is not found it will be searched by id

However if you want to search for a specific field you can pass it after the value

or

After executing the command it will ask you to enter a new password and confirm it

Delete Users

In the same way as the command to reset password user, the user is searched by email or id or by specifying a specific field.

or

If your model uses logical elimination, this is executed by default, however if you want to eliminate completely you can pass the --force argument

Restore Users

In the same way as the command to reset password user, the user is searched by email or id or by specifying a specific field.

or

Note that this command will only run if your model uses SoftDelete trait

Users With Roles and Permissions

If you want to add roles and permissions to your users, don't forget to configure the relationship name in your configuration file in addition to the role and permission model.

To grant permissions to your user is as easy as:

or

If you want to grant all permissions, you can do this:

Note that you must send a single permission flag otherwise it will not work.

Testing

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-user-commands with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
laravel/framework Version ^6.0|^7.0|^8.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 luilliarcec/laravel-user-commands contains the following files

Loading the files please wait ....