Run order of plugins

Can I define the order in which plugins run? I want to be notified of 404 errors immediately so I can find the broken links and fix them. I wrote a plugin to grab the onPageNotFound event and then send a message to me in a #grav-alerts Slack channel.

The problem is the required Error plugin. On line 48 it runs $event->stopPropagation();, so my plugin does not have the chance to run. If I comment out that line, I get the desired message. I don’t want to have to remember to comment that line out every time I upgrade.

As I clicked the Post button, I realized it was probably alphabetical, so I changed the name from SlackAlertsPlugin to AlertsPlugin, and it worked. If anyone knows a way to change the priority another way, I’d still like to know.

Yes, there is not any ordering other than the order that the filesystem iterates over the plugins. So if you want a plugin to fire first, you could name it appropriately.

This is something we plan on addressing in the future, but it is not a common need, and frankly yours is the first legitimate use case I’ve seen for it. So yours is the best solution for now!

Thanks for the quick reply. The alphabetical solution should work fine.

Wait this not true, because (if nothing changes) you can trigger the page not found event but not directly from plugin, you can get with setup.php into the root.
I need to search where I put this scripts, btw if you found a solution for you, you can use this ^^