- Can I use hyperf/tappable in a pure Laravel project without Hyperf dependencies?
- No, this package requires Hyperf’s container and coroutine system. You’d need to create a wrapper layer to abstract Hyperf’s dependencies or use Laravel’s native `illuminate/tappable` instead. The package isn’t designed for standalone Laravel use.
- How do I install hyperf/tappable in a Laravel project?
- You can’t directly install it in Laravel due to Hyperf dependencies. Instead, install it in a Hyperf project or use Composer’s `replace` directive in `composer.json` to alias it, but you’ll still need to handle Hyperf’s container integration manually.
- Does hyperf/tappable support Laravel’s service providers and facades?
- No, it’s built for Hyperf’s container and doesn’t integrate with Laravel’s Service Provider or Facade system. You’d need to manually bridge Hyperf’s container bindings to Laravel’s DI system if attempting integration.
- Will macros defined with hyperf/tappable work in Laravel’s event system?
- No, this package doesn’t integrate with Laravel’s event system. Macros are purely method extensions and won’t trigger Laravel events or interact with queue jobs. Use Laravel’s native `tappable` for event-related macro behavior.
- Is hyperf/tappable compatible with Laravel 10/11?
- No, this package is for Hyperf projects only and isn’t designed to work with Laravel. Laravel’s `illuminate/tappable` is the correct choice for Laravel 10/11. Hyperf’s version is a separate implementation.
- Can I use hyperf/tappable macros in Hyperf coroutines safely?
- The package supports coroutines, but macros like `tap()` may introduce blocking operations. Ensure callbacks are non-blocking or use Hyperf’s `go()` function to avoid coroutine deadlocks. Test thoroughly in async contexts.
- What’s the performance impact of using macros in Hyperf?
- Macros add reflection overhead at runtime, which could impact performance in Hyperf’s high-concurrency environments. Benchmark critical paths, especially if macros are used frequently in hot code paths like middleware or commands.
- Are there alternatives to hyperf/tappable for Laravel?
- Yes, Laravel’s native `illuminate/tappable` (included in Laravel) provides the same `Macroable`, `Arrayable`, and `Jsonable` traits. For Hyperf, this package is the direct equivalent, but it’s not interchangeable with Laravel’s version.
- How do I test hyperf/tappable in a Laravel project?
- You can’t test it directly in Laravel. Mock Hyperf’s container and coroutine context in your tests if you’re building a wrapper. Alternatively, test it in a Hyperf project and verify behavior matches Laravel’s expectations via shared interfaces.
- Is hyperf/tappable actively maintained? Should I use it in production?
- The package has low adoption (1 star, no dependents) and no recent updates. Use it cautiously in production, especially if Hyperf’s core dependencies change. Consider forking or rewriting critical parts if long-term stability is a concern.