{"id":34811258,"url":"https://github.com/backstagephp/laravel-users","last_synced_at":"2026-05-22T08:42:38.521Z","repository":{"id":325473307,"uuid":"981155366","full_name":"backstagephp/laravel-users","owner":"backstagephp","description":"[READ ONLY] Subtree split of the Backstage CMS package - Laravel users. See backstage/core","archived":false,"fork":false,"pushed_at":"2026-05-01T09:51:03.000Z","size":135,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-05-01T11:20:40.181Z","etag":null,"topics":[],"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/backstagephp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"vormkracht10"}},"created_at":"2025-05-10T13:16:23.000Z","updated_at":"2026-02-16T23:56:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/backstagephp/laravel-users","commit_stats":null,"previous_names":["backstagephp/laravel-users"],"tags_count":217,"template":false,"template_full_name":"backstagephp/laravel-package-template","purl":"pkg:github/backstagephp/laravel-users","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backstagephp%2Flaravel-users","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backstagephp%2Flaravel-users/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backstagephp%2Flaravel-users/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backstagephp%2Flaravel-users/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/backstagephp","download_url":"https://codeload.github.com/backstagephp/laravel-users/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backstagephp%2Flaravel-users/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33335447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T12:23:38.849Z","status":"online","status_checked_at":"2026-05-22T02:00:06.671Z","response_time":265,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-12-25T12:54:11.513Z","updated_at":"2026-05-22T08:42:38.515Z","avatar_url":"https://github.com/backstagephp.png","language":"PHP","funding_links":["https://github.com/sponsors/vormkracht10"],"categories":[],"sub_categories":[],"readme":"# Laravel Users\n\nA modern user management package for Laravel, built by [Backstage](https://backstagephp.com).\n\n---\n\n## ✨ Introduction\n\n`backstage/laravel-users` is a full-featured Laravel package that provides a complete user management foundation for Laravel 10 \u0026 11 applications. It leverages Laravel Sanctum and Spatie Permissions to deliver robust authentication, authorization, and user preference handling.\n\nThis package includes support for user login tracking, traffic monitoring, preferences, factory seeding, and customizable scaffolding—all designed to scale with your application.\n\n---\n\n## 📦 Features\n\n- ✅ Custom user model with Laravel Auth integration\n- 🔐 Role and permission support via [Spatie Laravel Permission](https://spatie.be/docs/laravel-permission)\n- 🔑 API token authentication via Laravel Sanctum\n- 🔧 Configurable user system with feature toggles\n- 🧪 Built-in factory and seeder\n- 📊 Tracks login events and traffic history\n- 🧩 Modular architecture with domain-driven design (DDD) patterns\n- 🛠 Artisan commands for user management (`make`, `list`, `delete`)\n- 📨 Email-based username generation\n- 🔄 Password generation utility\n- 🧠 Customizable notification \u0026 sub-navigation preferences\n\n---\n\n## 🧰 Requirements\n\n- PHP ^8.2\n- Laravel ^10.0 or ^11.0\n- Composer\n\n---\n\n## ⚙️ Installation\n\nInstall via Composer:\n\n```bash\ncomposer require backstage/laravel-users\n```\n\nPublish configuration, migration, and seeder files:\n\n```bash\nphp artisan vendor:publish --tag=\"laravel-users-config\"\nphp artisan vendor:publish --tag=\"laravel-users-migrations\"\n```\n\nRun database migrations:\n\n```bash\nphp artisan migrate\n```\n\n---\n\n## 🛠 Configuration\n\n### 1. Set the User Provider\n\nUpdate `config/auth.php` to use the package's custom user model:\n\n```php\n'providers' =\u003e [\n    'users' =\u003e [\n        'driver' =\u003e 'eloquent',\n        'model' =\u003e \\Backstage\\Laravel\\Users\\Models\\User::class,\n    ],\n],\n```\n\n### 2. Enable Sanctum API Tokens\n\nIf you haven't already:\n\n```bash\ncomposer require laravel/sanctum\nphp artisan vendor:publish --provider=\"Laravel\\\\Sanctum\\\\SanctumServiceProvider\"\nphp artisan migrate\n```\n\n### 3. Setup Spatie Permissions\n\nEnsure Spatie permissions are published:\n\n```bash\ncomposer require spatie/laravel-permission\nphp artisan vendor:publish --provider=\"Spatie\\\\Permission\\\\PermissionServiceProvider\"\nphp artisan migrate\n```\n\nEdit `config/permission.php` to adjust your roles and permission settings.\n\n---\n\n## 🧩 Customization\n\nYou can modify `config/users.php` to change:\n\n- Default roles\n- Middleware behavior\n- Feature toggles (registration, email verification, etc.)\n- UI scaffolding paths (if applicable)\n\n---\n\n## 🧑‍💻 Artisan Commands\n\nThe package includes a suite of CLI tools:\n\n| Command                        | Description                       |\n|-------------------------------|-----------------------------------|\n| `artisan make:user`          | Create a new user interactively   |\n| `artisan users:list`          | List users in a table format      |\n| `artisan users:delete`        | Delete a user by ID or email      |\n\nExample:\n\n```bash\nartisan make:user --email=user@example.com --name=\"John Doe\" --role=admin\n```\n\n---\n\n## 🧱 Architecture\n\n### Key Classes\n\n- **UserManager**: Central config-driven service for runtime overrides\n- **Domain/Email/Actions**:\n  - `GenerateUsernameFromEmail`\n  - `ExtractDomainFromEmail`\n  - `ValidateEmail`\n- **Domain/Password/Actions**:\n  - `GeneratePassword`\n- **Eloquent/Concerns/User**:\n  - Modular traits like `HasAttributes`, `HasScopes`, `HasRelations`\n- **Models**:\n  - `User`, `UserLogin`, `UserTraffic`, `UserNotificationPreferences`\n\n### Migrations Included\n\n- Adds sub-navigation and notification preferences to users\n- Tracks user logins and traffic history\n- Supports nullable password for third-party auth\n\n---\n\n## 🧪 Testing\n\nRun PHPUnit tests via:\n\n```bash\nvendor/bin/phpunit\n```\n\nEnsure your `.env.testing` or `phpunit.xml` is configured with a test database.\n\n---\n\n## 🔬 Development\n\n### Local Package Development\n\nIf you're contributing or using this in a monorepo:\n\n1. Clone the package into `packages/` or your preferred folder\n2. Add this to your Laravel app's `composer.json`:\n\n```json\n\"repositories\": [\n  {\n    \"type\": \"path\",\n    \"url\": \"packages/laravel-users\"\n  }\n],\n```\n\n3. Require the package:\n\n```bash\ncomposer require backstage/laravel-users:*\n```\n\n4. Refresh autoload:\n\n```bash\ncomposer dump-autoload\n```\n\n---\n\n## 🤝 Contributing\n\nContributions are welcome! Please follow the PSR-12 coding standard and submit pull requests with clear descriptions.\n\n---\n\n## 📄 License\n\nThis package is open-sourced software licensed under the [MIT license](LICENSE.md).\n\n---\n\n## 👤 Author\n\n**Manoj Hortulanus**  \nDeveloper at [Backstage](https://backstagephp.com)  \n📧 \u003cmanoj@backstagephp.com\u003e\n\n---\n\n## 🏁 Credits\n\n- [Backstage](https://backstagephp.com) for sponsoring development\n- [Spatie](https://spatie.be) for the excellent permission package\n- [Laravel](https://laravel.com) for the amazing framework\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbackstagephp%2Flaravel-users","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbackstagephp%2Flaravel-users","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbackstagephp%2Flaravel-users/lists"}