PHP
NO
Custom Callbacks with Invoke
[]
blog.phpdeveloper.org
So, I added in the “object.callback” match type that allows you to call a static method in your own code and perform the evaluation yourself.
Say you have this configuration in your routes.yml file:/foo: protected: on callback: \App\MyUser::testThis tells Invoke that when the user requests the /foo URL, the protection should kick in.
This class needs to be autoloadable so that Invoke can directly call it and its static method.
Yep, that’s right – it needs to be a static method but you’ll be provided with everything about the request in the incoming $data variable.
Adding these callbacks makes the Invoke system a lot more flexible and allows you to create those custom match types without having to have whole other classes just to perform your checks.
['request'
'method'
'route'
'callbacks'
'custom'
'resource'
'requested'
'match'
'static'
'current'
'user'
'invoke']