Replace a core class that is not in the IOC
I want to extend/switch-out the Illuminate\Queue\SqsQueue class. The problem I have is that this queue is already being extended by another package I am using (Laravel Vapor).
If I simply extend the SQS queue implementation in the IOC, then vapor overwrites it.
One way I could do this is to:
- Disable the vapor service provider.
- Write my own that extends it.
- Extend the SQS queue myself, using the same method as vapor but then switch out with my Illuminate\Queue\SqsQueue class.
This feels like I am changing a lot / would need to maintain a lot when all I need to do is switch out/extend the one class.
Second to this, if we are not using vapor then I would still want the switch out to happen, so it would mean repeating the process again for each new implementation.
What I really want to do, it just tells Laravel to use my class whenever it tries to instantiate SqsQueue::class.
I know this can be hacked in composer, but what is the proper way of doing it?
Please or to participate in this conversation.