- How do I install this package in a new Laravel 8+ project?
- Run `composer require fukibay/laravel-starter-pack` and execute `php artisan fukibay:install`. The interactive CLI will guide you through database driver selection and base configuration. No manual setup is required for core features.
- Does this package work with existing Laravel projects, or only new ones?
- This package is designed for new projects. For existing ones, you’d need to manually refactor modules to adopt the Repository-Service pattern before using the scaffolding commands. A phased approach (per-module adoption) is recommended.
- What Laravel versions are supported, and are there PHP requirements?
- The package officially supports Laravel 8+. PHP 8.0+ is recommended for full compatibility, especially for type hints and modern Eloquent features. Check the package’s `composer.json` for exact version constraints.
- How does the `QueryParameters` DTO simplify database queries?
- The `QueryParameters` DTO lets you define `where`, `orderBy`, `limit`, `relations`, and `scopes` in a single object. Instead of chaining Eloquent methods, you pass this DTO to your repository’s `find()` or `list()` methods, reducing boilerplate and improving readability.
- Can I customize the generated Repository/Service classes after installation?
- Yes, the package generates boilerplate but leaves full control over the logic. Override methods in the generated classes or extend them. The scaffolding avoids opinionated decisions, so you can adapt it to your project’s needs without restrictions.
- Does this package handle SoftDeletes automatically for all models?
- The package detects `SoftDeletes` in your Eloquent models and automatically applies the `ProxiesSoftDeletes` trait to the corresponding Service class. However, you must manually add `SoftDeletes` to your models if not already present.
- What if I need custom repository methods beyond CRUD?
- The scaffolding includes hooks for custom methods. Extend the generated repository classes or create interfaces to define additional logic. The package doesn’t enforce a rigid structure, so you can add domain-specific methods as needed.
- Are there any testing utilities included, or do I need to write tests manually?
- The package doesn’t include built-in testing utilities, but the generated Repository/Service structure makes unit testing straightforward. You’ll need to write tests manually, leveraging Laravel’s built-in testing helpers or packages like Pest.
- How does this package handle API error responses and validation?
- The package includes an `ApiResponder` trait for consistent JSON responses and a `Handler.php` for standardizing API exceptions (e.g., `ValidationException`). Customize these files to match your project’s error-handling requirements.
- What are the alternatives if I don’t want to use Repository/Service layers?
- For simpler projects, consider Laravel’s built-in Eloquent ORM or packages like `spatie/laravel-query-builder` for advanced queries. If you prefer a different architecture, frameworks like `Laravel Nova` (for admin panels) or `Laravel Sanctum` (for auth) can complement your existing setup.