- How does Biz Framework differ from Laravel’s built-in services and repositories?
- Biz Framework enforces stricter separation of concerns with Domain Services, Repository interfaces, and a dedicated event system, whereas Laravel’s native patterns are more flexible but less opinionated. It’s ideal for teams adopting DDD or clean architecture, while Laravel’s services work well for simpler applications.
- Can I use Biz Framework in Laravel 10 with PHP 8.2?
- The last release was in 2019, so PHP 8.x support isn’t guaranteed. You’d need to manually patch compatibility issues (e.g., named arguments, attributes) or fork the package. Test thoroughly in a staging environment before production use.
- What’s the easiest way to migrate existing Laravel services to Biz Framework?
- Start by wrapping your business logic in `DomainService` classes while keeping controllers intact. Use dependency injection to replace Laravel services with framework-specific ones incrementally. The README provides a clear phase-by-phase migration guide.
- Does Biz Framework support Laravel’s middleware, policies, or API resources?
- Yes, but you’ll need adapters. For example, bind a `DomainService` to Laravel’s container and use middleware/policies as usual. API resources can consume domain services via controllers, though some manual wiring may be required.
- How does error handling work in Biz Framework compared to Laravel?
- Biz Framework introduces `DomainException` for business logic errors, separate from Laravel’s `HttpResponseException`. You’ll need to map domain exceptions to HTTP responses in controllers or middleware. This enforces clearer error boundaries.
- Will Biz Framework slow down my Laravel application?
- The abstraction layers add minimal overhead, but performance impact depends on your use case. For high-throughput systems, benchmark critical paths (e.g., repository queries) and optimize with caching or direct Eloquent calls where needed.
- Can I use Biz Framework alongside Laravel’s Jobs and Queues?
- Yes, but the framework encourages replacing Jobs with `DomainCommand` for better alignment with DDD. You can still use Laravel Queues for async workflows by binding framework events to queue jobs.
- Are there alternatives to Biz Framework for Laravel’s service layer?
- For DDD-focused alternatives, consider `spatie/laravel-data` (for immutable data transfer) or `nWidart/laravel-modules` (for modularity). However, Biz Framework is more opinionated about service layers and repositories, making it a stronger fit for complex domain logic.
- How do I test Biz Framework components in Laravel?
- Use PHPUnit with the framework’s `DomainServiceTestCase` for unit testing. For integration tests, mock repositories and services while leveraging Laravel’s testing helpers (e.g., `Http::fake()`). The framework’s design encourages testability via interfaces.
- What’s the maintenance status of Biz Framework, and should I use it in production?
- The package is unmaintained since 2019, but it’s stable for PHP 7.4+. For production, assess your risk tolerance: if you can’t patch PHP 8.x issues, consider a fork or alternative. Monitor for forks or community updates before committing.