{"id":16676934,"url":"https://github.com/luilliarcec/laravel-user-commands","last_synced_at":"2026-04-20T21:36:13.398Z","repository":{"id":49130258,"uuid":"325327138","full_name":"luilliarcec/laravel-user-commands","owner":"luilliarcec","description":"Laravel User Commands is a package that provides the necessary commands for user manipulation from the console.","archived":false,"fork":false,"pushed_at":"2021-09-02T22:28:20.000Z","size":119,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-31T10:29:29.793Z","etag":null,"topics":["commands","laravel","php7","php8","user-command","user-manipulation"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luilliarcec.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-29T15:52:53.000Z","updated_at":"2021-09-02T22:28:14.000Z","dependencies_parsed_at":"2022-09-16T17:51:01.259Z","dependency_job_id":null,"html_url":"https://github.com/luilliarcec/laravel-user-commands","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/luilliarcec/laravel-user-commands","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luilliarcec%2Flaravel-user-commands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luilliarcec%2Flaravel-user-commands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luilliarcec%2Flaravel-user-commands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luilliarcec%2Flaravel-user-commands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luilliarcec","download_url":"https://codeload.github.com/luilliarcec/laravel-user-commands/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luilliarcec%2Flaravel-user-commands/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32067617,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T21:26:33.338Z","status":"ssl_error","status_checked_at":"2026-04-20T21:26:22.081Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["commands","laravel","php7","php8","user-command","user-manipulation"],"created_at":"2024-10-12T13:24:36.471Z","updated_at":"2026-04-20T21:36:13.355Z","avatar_url":"https://github.com/luilliarcec.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel User Commands V3\n\n![run-tests](https://github.com/luilliarcec/laravel-user-commands/workflows/run-tests/badge.svg)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/luilliarcec/laravel-user-commands.svg)](https://packagist.org/packages/luilliarcec/laravel-user-commands)\n[![Quality Score](https://img.shields.io/scrutinizer/g/luilliarcec/laravel-user-commands)](https://scrutinizer-ci.com/g/luilliarcec/laravel-user-commands)\n[![Total Downloads](https://img.shields.io/packagist/dt/luilliarcec/laravel-user-commands)](https://packagist.org/packages/luilliarcec/laravel-user-commands)\n[![GitHub license](https://img.shields.io/github/license/luilliarcec/laravel-user-commands)](https://github.com/luilliarcec/laravel-user-commands/blob/develop/LICENSE.md)\n\nIf like me, you have ever considered having commands to manipulate users within your application, this package will help\nyou.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require luilliarcec/laravel-user-commands\n```\n\nNow publish the configuration file into your app's config directory, by running the following command:\n\n```bash\nphp artisan vendor:publish --provider=\"Luilliarcec\\UserCommands\\UserCommandsServiceProvider\"\n```\n\nThat is all. 😀\n\n## Usage\n\nThe package has 4 basic commands\n\n| Commands | Description | \n| --- | --- | \n| user:create | Create a new user in your app | \n| user:reset-password | Restore a user's password | \n| user:delete | Delete a user | \n| user:restore | Restore a user |\n\n### Create Users\n\n```bash\nphp artisan user:create\n```\n\n###### Fields\n\nAll the fields defined in your fillable property of your model will be used when executing the command. If you want to\nadd more fields you can do it from your config file (your file takes precedence over your model, so if you define the\nfields in your config file the fields of your fillable property will be ignored)\n\n###### Rules\n\nWhether you have fields defined in your model or in the configuration file, the `filled` rule will be dynamically\napplied to those fields. If you want to add custom rules you can do it from the rules key from your configuration file,\nthese will be merged in such a way that those fields that have not been given a custom rule will use the `filled` rule\nby default.\n\nAfter all, you are free to extend the command and configure it to your liking.\n\n```bash\nphp artisan user:create -a username:larcec -a \"other_field:Value of field\"\n```\n\nor\n\n```bash\nphp artisan user:create --attributes=username:larcec --attributes=\"other_field:Value of field\"\n```\n\nIf you want to mark the user's email as verified you can pass the argument `--verified` Ex.:\n\n```bash\nphp artisan user:create --verified\n```\n\nIf your model uses roles and permissions, you must configure the model of the roles and permissions and the name of the\nrelationships in the configuration file.\n\nYou can then pass the permissions or roles as arguments.\n\n```bash\nphp artisan user:create -p \"user-create\" -p \"user-edit\"\n```\n\nIt should be noted that the `roles` and `permissions`  \nmust already exist in your database and will be searched by the `name` field\n\nOnce the user has been created, the `notification` that it has been created will be sent if it implements\nthe `MustVerifyEmail` interface and if the `verification.verify` route name exists\n\nIf you want to apply your own logic or just save default data for all users, you can extend the command and apply your\nnecessary logic, or copy the `prepareForSave` method and add your necessary data. Ex.:\n\n```php\n\u003c?php\n\nnamespace App\\Commands;\n\nuse Luilliarcec\\UserCommands\\Commands\\CreateNewUserCommand as CreateNewUserCommandBase;\n\nclass CreateNewUserCommand extends CreateNewUserCommandBase\n{\n    protected function prepareForSave(): array\n    {\n        return $this-\u003emerge([\n            'password' =\u003e Hash::make($this-\u003edata['password']),\n            'username' =\u003e Username::make($this-\u003edata['name']),\n        ]);\n    }\n}\n```\n\n`$this-\u003edata` will contain the data of the user that was asked, if you want to access your data that you entered with\nthe `--attribute` flag you can do it by calling the `attributes` function which will return a `key =\u003e value`\narray with your data.\n\n### Reset Password User\n\nThe command to `reset password user` receives the value parameter as required. It will be searched by `email` and if it\nis not found it will be searched by `id`\n\n```bash\nphp artisan user:reset-password luis@email.com\n```\n\nHowever if you want to search for a specific field you can pass it after the value\n\n```bash\nphp artisan user:reset-password larcec -f username\n```\n\nor\n\n```bash\nphp artisan user:reset-password larcec --field username\n```\n\nAfter executing the command it will ask you to enter a new password and confirm it\n\n### Delete Users\n\nIn the same way as the command to `reset password user`, the user is searched by email or id or by specifying a specific\nfield.\n\n```bash\nphp artisan user:delete luis@email.com\n```\n\nor\n\n```bash\nphp artisan user:delete larcec --field username\n```\n\nIf your model uses logical elimination, this is executed by default, however if you want to eliminate completely you can\npass the --force argument\n\n```bash\nphp artisan user:delete larcec --field username --force\n```\n\n### Restore Users\n\nIn the same way as the command to `reset password user`, the user is searched by email or id or by specifying a specific\nfield.\n\n```bash\nphp artisan user:restore luis@email.com\n```\n\nor\n\n```bash\nphp artisan user:restore larcec --field username\n```\n\nNote that this command will only run if your model uses SoftDelete trait\n\n### Users With Roles and Permissions\n\nIf you want to add roles and permissions to your users, don't forget to configure the relationship name \nin your configuration file in addition to the role and permission model.\n\nTo grant permissions to your user is as easy as:\n\n```bash\nphp artisan user:create -p \"user-create\" -p \"user-edit\"\n```\n\nor\n\n```bash\nphp artisan user:create --permissions=\"user-create\" --permissions=\"user-edit\"\n```\n\nIf you want to grant all permissions, you can do this:\n\n```bash\nphp artisan user:create -p *\n```\n\nNote that you must send a single permission flag otherwise it will not work.\n\n## Testing\n\n``` bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email luilliarcec@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [Luis Andrés Arce C.](https://github.com/luilliarcec)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluilliarcec%2Flaravel-user-commands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluilliarcec%2Flaravel-user-commands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluilliarcec%2Flaravel-user-commands/lists"}