dreamfactory/df-user
DreamFactory's df-user package provides user account and authentication management for PHP/Laravel applications, with APIs for profiles, roles, and access control to help integrate secure user handling into DreamFactory-based projects.
dreamfactory/df-user is not a package you composer require into an existing Laravel app — it is a DreamFactory platform module that ships inside the dreamfactory/dreamfactory distribution. Your "day one" steps are therefore about operating the platform, not wiring up a provider.
composer show dreamfactory/df-user in the DreamFactory root, or grep config/app.php / the package discovery cache for DreamFactory\Core\User\Providers\UserServiceProvider. The module is auto-discovered in a standard install.src/Models/User.php — Eloquent model, $hidden, $fillable, password mutator, getAuthIdentifierName().src/Models/Role.php and UserApp.php — the RBAC and app-scoping relationships.src/Services/User.php — the BaseSystemResource subclass that maps HTTP verbs to model operations and defines the OpenAPI schema.database/migrations/ — user, role, user_role, and lookups.php artisan dreamfactory:setup (or df:refresh --seed in dev) so the module migrations and default roles (admin, user) exist.POST /api/v2/user/session with {"email":"...","password":"..."} returns a session token plus the user record. Then GET /api/v2/system/user/{id} with that token. This is the fastest way to see what the package actually exposes before you touch code.If you're integrating an existing Laravel app, treat DreamFactory as a user/auth backend and call those REST endpoints from a Laravel HTTP client rather than trying to embed the module.
API-first consumption. Almost everything you need is a platform endpoint: system/user for admin CRUD, user/register for self-service signup, user/password for change-password, user/request_password_reset + user/password_reset for the reset flow. Wrap these in a small Laravel service class so the rest of your app never sees raw DreamFactory URLs.
Custom fields. To add profile data (phone, tenant_id, preferences), create a new migration in your own DreamFactory package that alters the user table, and extend the User model via a model-extending event or a subclassed service. Do not edit the vendor directory — your changes vanish on composer update.
Event scripts for business logic. DreamFactory fires pre/post events per service operation (user.get.pre_process, user.post.post_process, system.user.create.post_process, etc.). Register listeners in your own package's service provider:
Event::listen('df.user.post.post_process', function ($event) {
// $event->request, $event->response, $event->resource
Mail::to($event->response->content['email'])->queue(new WelcomeMail(...));
});
This is the sanctioned extension point for onboarding emails, audit logging, and syncing users into an external IdP.
Roles as the integration seam. Assign roles on create/update via the user_role pivot; roles bind to apps, services, and system resources. In practice you create one role per API surface (e.g. mobile-app, admin-console) in the admin UI and just set role_id on user records from your provisioning code.
Testing. Hit the endpoints with a php artisan tinker HTTP call or a Pest test using Http::withToken($sessionToken)->post(...). Faster feedback than clicking through the admin console.
df-user is tightly coupled to dreamfactory/dreamfactory and df-core. A stray composer update on the module alone will break the service registration. Pin both.php artisan migrate blindly; use dreamfactory:setup / df:refresh so ordering and seeding (default roles, admin user) happen correctly.password with Hash::make. If you backfill users from a legacy system, insert pre-hashed bcrypt strings — never plaintext — and set the mutator bypass deliberately.is_sys_admin is a big hammer. It bypasses role checks entirely. Prefer a scoped role for anything short of true platform administration, and audit any code path that sets it to true.php artisan cache:clear / the platform's cache-clear endpoint). Budget for this in tests.confirm_code, reset_password_code, and oauth_provider are vestigial in newer flows; check src/Services/User.php for which are still honoured before building on them.APP_DEBUG=true in the DreamFactory .env and tail storage/logs/laravel.log; service exceptions surface as JSON with a error.code — cross-reference it against the module's exception classes rather than guessing.src/Services/User.php and the df-core base classes; that's the real documentation.How can I help you explore Laravel packages today?