- How do I integrate this installer with Laravel Fortify or Sanctum for admin creation?
- The installer uses a service provider to create admins, but you can override this by extending the `AdminCreator` service or using middleware to inject your own logic. Publish the installer’s config and modify the `admin` step to point to your custom auth system. For Fortify/Sanctum, ensure your user model aligns with the installer’s expectations or abstract the admin creation entirely via events.
- Can I dynamically add or remove installer steps based on my app’s features?
- Yes, the installer is fully config-driven. Use the `steps` array in the published config to add, remove, or reorder steps. For dynamic behavior, publish the views and extend the `InstallerStep` class to conditionally render steps based on environment variables, feature flags, or user input. Hooks like `beforeStep` and `afterStep` allow further customization.
- What happens if the database connection test fails during installation?
- The installer halts and displays an error message, but it does not roll back changes made before the failure (e.g., `.env` updates or directory permissions). To handle this, implement a retry mechanism in your custom step logic or use Laravel’s `try-catch` blocks to gracefully degrade. For production, consider wrapping the installer in a transaction or backup the database before running it.
- Does this package support multi-environment setups (e.g., staging vs. production)?
- The installer reads from `.env` files, so you can define environment-specific configurations (e.g., `APP_ENV=staging` or `DB_DATABASE=staging_db`). Use Laravel’s `config()` helper or environment variables to dynamically adjust installer behavior, such as skipping certain steps or modifying validation rules. Test thoroughly with your CI/CD pipeline to ensure consistency across environments.
- How do I customize the UI to match my Laravel app’s branding?
- Publish the installer’s assets with `php artisan vendor:publish --tag=installer-assets` to override the Tailwind CSS and Blade views. Modify the `resources/views/vendor/installer/` files to match your theme. For dynamic branding, use Laravel’s view composers or Livewire’s `mount` method to inject variables like logo paths or color schemes into the installer’s components.
- Is there a way to test the installer without affecting my production database?
- Yes, use SQLite for testing by configuring a temporary database in your `.env.testing` file. The installer supports SQLite out of the box, and you can mock the `DatabaseConnection` service provider to simulate failures or successes. For end-to-end testing, use Laravel’s `artisan` testing helpers or browser automation tools like Laravel Dusk to verify the installer flow without manual intervention.
- Will this work with Laravel Breeze or Jetstream for authentication?
- The installer’s admin creation is designed to work with Laravel’s default auth system, but conflicts may arise if you’re using Breeze/Jetstream due to differences in user model structure or guard configurations. Override the `AdminCreator` service or extend the `createAdmin` method to align with your auth system’s requirements. Ensure your user model implements the expected traits (e.g., `MustVerifyEmail` if applicable).
- Can I use this installer for a non-commercial Laravel project?
- Absolutely. The package is MIT-licensed and free to use in both commercial and non-commercial projects. However, note that the installer’s features (e.g., admin creation, database setup) are optimized for commercial distributions where polished onboarding reduces support overhead. For personal or open-source projects, you may need to customize steps like license key validation or multi-user setup.
- How do I handle custom PHP extensions or environment variables during installation?
- Extend the `ServerRequirements` or `EnvironmentVariables` steps by publishing their views and overriding the logic. For PHP extensions, modify the `requiredExtensions` array in the config to include your custom requirements. For environment variables, use the `dynamicEnvVars` config option to prompt users for values during the database setup step, then inject them into `.env` automatically.
- What are the alternatives to this package, and when should I consider them?
- Alternatives include **spatie/laravel-installer** (simpler, less customizable) and **laravel/valet** (for local development only). Choose this package if you need a modern, Livewire-powered UI with deep customization for commercial products. Use spatie’s installer for lightweight needs or Valet for local setups. If you require multi-tenancy or advanced database setups, consider building a custom solution or combining this package with **laravel-zero** for CLI-based installers.