- How do I install baks-dev/settings-main in a Laravel project?
- Run `composer require baks-dev/settings-main` to install the package. Then execute `php artisan baks:assets:install` to set up configuration files and resources. Ensure your Laravel project uses PHP 8.4+ and Doctrine DBAL for database compatibility.
- Does this package work with Laravel 10 or 11?
- The package requires PHP 8.4+, but Laravel version compatibility isn’t explicitly stated. Test thoroughly with your Laravel version, as the package may rely on undocumented hooks or Symfony components that could conflict. Check the GitHub repo for updates or fork if needed.
- Can I extend the settings schema to add custom fields like tenant_id?
- The package uses Doctrine migrations, so you can create custom migrations to extend the schema. However, ensure your changes don’t conflict with the package’s core tables. Review the generated migrations via `doctrine:migrations:diff` before applying custom logic.
- How are settings cached, and how do I invalidate them on updates?
- The package doesn’t explicitly document caching integration, so settings may rely on Laravel’s default config caching. To invalidate caches, manually clear them with `php artisan config:clear` or implement an event listener for `SettingsUpdated` if supported.
- Is this package suitable for multi-tenancy with isolated settings?
- The package lacks built-in multi-tenancy support. To implement tenant-isolated settings, you’d need to add a `tenant_id` column to the settings table via a custom migration and filter queries accordingly. Consider alternatives like Spatie’s package if multi-tenancy is critical.
- What database systems does baks-dev/settings-main support?
- The package supports MySQL, PostgreSQL, and SQLite via Doctrine DBAL. Ensure your database collation (e.g., `utf8mb4_unicode_ci`) handles non-ASCII settings like Russian text. Test migrations with your target database before production deployment.
- Are there alternatives to this package for Laravel settings management?
- Yes. Consider **Spatie Laravel Settings** (Eloquent-based, more mature) or Laravel’s native `config()` system with caching for simpler needs. If you need Doctrine integration, evaluate whether this package’s rigid schema fits your workflow before committing.
- How do I test if settings updates work correctly in concurrent environments?
- Write integration tests using `--group=settings-main` to simulate concurrent writes. Test race conditions by updating a setting while another process reads it. Use Laravel’s `freshOnEachRequest()` or database transactions to isolate test scenarios.
- Does this package integrate with Laravel’s event system for setting changes?
- The package may support events like `SettingsUpdated`, but this isn’t documented. Check the source code for event dispatchers or create custom listeners to react to changes. If missing, consider extending the package or using a middleware-based approach.
- What should I do if the package is abandoned or lacks updates?
- Fork the repository and maintain it internally, especially if it’s critical to your project. Monitor GitHub activity for signs of abandonment. As a fallback, implement a custom solution using Laravel’s config system or Spatie’s package for long-term stability.