- How do I install lacodix/laravel-scoped-mail-config in a Laravel app?
- Install it with composer require lacodix/laravel-scoped-mail-config. Add the HasMailConfig contract or concern to your scope model, implement getMailConfig($name): array, and register ScopedMail::resolveScopeUsing(...) in AppServiceProvider. The release history supports Laravel 10, 11, and 12, with PHP requirements following the framework and no exotic dependencies.
- Does laravel-scoped-mail-config work with spatie/laravel-multitenancy?
- The README explicitly targets spatie/laravel-multitenancy, and the package resolves mail configuration from a scope model such as the current tenant. Compatibility with stancl/tenancy or a custom tenancy layer is not verified, so confirm how your tenant is resolved in HTTP and queue contexts. The integration is mechanically simple, but scope resolution must be tested in your own middleware and worker setup.
- Does laravel-scoped-mail-config work with queued mailables and queue workers?
- This is the top technical risk: default scope resolution is the authenticated user, and that context does not exist inside a queued mailable or worker process. Queued mail can therefore fall back to the global mail configuration or, with a stale scope, send under the wrong tenant identity. Serialize the tenant onto the mailable and rehydrate it in handle(), or explicitly set the scope before sending. Also verify that the implementation resolves configuration per send rather than mutating global mail.* keys.
- How do I send per-tenant email from notifications, password resets, and third-party packages?
- The package only owns configuration selection, so every tenant-scoped send must move from Mail:: to ScopedMail::. That touches notifications, queued mailables, password resets, invites, and packages such as Fortify, Breeze, Cashier, and Nova that send through the default facade. Those call sites keep using the global configuration silently and invisibly, making call-site migration the main integration cost.
- Is it safe to store per-tenant SMTP passwords on the tenant model?
- Credentials live on the tenant model, which means per-tenant SMTP passwords can appear in database backups, dumps, logs, and serialized payloads. Use encrypted casts, key rotation, log exclusion, and restricted access, and treat this as a security review item rather than a footnote. If you only need per-tenant from-address or branding, one verified sending domain with per-tenant aliases is cheaper and safer.
- Which Laravel and PHP versions does lacodix/laravel-scoped-mail-config support?
- Laravel 10, 11, and 12 are supported across the release history, and PHP requirements follow the framework. Check the Composer constraints for the exact package version you plan to use. The package is a thin decorator over Laravel's Mail facade and has no exotic dependencies or extensions.
- How do I test scoped mail configuration in Laravel?
- ScopedMail::fake() covers only the new facade, so existing Mail::fake() assertions will not catch an unscoped send and scope regressions can ship green. Add tests that assert tenant-scoped mailables and notifications resolve, queue, and send through ScopedMail. Also test the no-scope fallback behavior in CLI, scheduler, and queue contexts.
- What happens when no scope is resolved in CLI, scheduler, or queue contexts?
- Default scope resolution uses the authenticated user, which is absent in CLI, scheduler, and queue worker contexts. The package documentation and evaluation notes do not establish whether the fallback is fail-closed or fail-open, so you must determine that in source and test it. A fail-open fallback can silently send with the global configuration, while a stale scope can use the wrong tenant identity. Decide the expected behavior and serialize the tenant for each job.
- Is laravel-scoped-mail-config production-ready or should I build it myself?
- It has 1 star, 0 dependents, a single maintainer, and no visible security policy or community channel, so treat it as unsupported code. The MIT license and tiny surface make forking cheap, but a 1-star dependency for a few hundred lines you could own outright is a legitimate build-versus-buy question. If you only need per-tenant from-address or branding, that is dramatically cheaper and safer than per-tenant credentials. If a mis-send means tenant A's invoice arriving from tenant B's domain, set the testing and rollout bar accordingly.
- What is the difference between the HasMailConfig interface and trait in laravel-scoped-mail-config?
- The README imports Lacodix\LaravelScopedMailConfig\Concerns\HasMailConfig but declares implements HasMailConfig, which is internally inconsistent. Confirm in source whether the contract is an interface, a trait, or both before estimating work or writing integration code. This affects how you add it to Tenant, Team, User, or another scope model.