New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Extension boot method priority #974
Comments
I've encountered this problem before, and what I usually do is determine which of the events to boot once all extensions (service providers) have been booted, and then use the
Another approach would be to implement something similar to Laravel Middleware priorities or just use 'installed.json' to ensure that extensions are loaded in the order in which they were installed, which will also work nicely with the |
Oho! Thanks for the tip about Is the |
Yes, that is the intended purpose of the |
Sorry, I'm re-visiting this and realize that I was using the Something like CupNoodles@646e2f5 - will make a PR into |
What is the feature?
I'm not sure if this is already possible, and if it is then please let me know how and I'll close this issue!
Basically, I have a lot of Extensions and many of them listen to the same events, and in some cases it's necessary to know which order the Extensions will be booted in. Right now, the order seems to differ from server to server for me, implying that it has something to do with PHP file listing order which we don't have control over (and don't need).
As an example, if extension A adds a button to a menu and extension B removes the button (if it's been added) and then adds it's own button, then if the extensions load [A,B] then we get one button, as expected, but if they boot in [B,A] order then we end up with 2 buttons. If I don't have control over extension A, then there's no way for extension B to conditionally remove extension A's button in it's
boot()
method, without knowing for sure that it'll be booted after extension A.I've got a sample branch of how this could work at https://github.com/tastyigniter/TastyIgniter/compare/3.x...CupNoodles:dk/extension_boot_priority?expand=1. Adding the
boot_priority
property to your Extension class would then conditionally sort your boot method.Version
Other (please detail)
The text was updated successfully, but these errors were encountered: