Answer the question
In order to leave comments, you need to log in
Where is the best place to place the initialization files of third-party libraries in the slim framework or other microframeworks?
In general, a question of a theoretical nature, from the series "there are a lot of solutions, which is the best."
I invite unemployed people to the dialogue.
Essence. I use the slim framework , there is no built-in validation, I thought about using some kind of library. Outwardly, I liked the well-known vlucas / valitron
library. I got
to the point of custom rules, I decided to make a rule for myself that checks if the email was sent for registration unique.
The implementation of custom rules is as follows:
Valitron\Validator::addRule('alwaysFail', function($field, $value, array $params, array $fields) {
return false;
}, 'Everything you do is wrong. You fail.');
Answer the question
In order to leave comments, you need to log in
Xs as it is in slim, but in laravel there is a boot method in service providers, which is called after registering all the framework dependencies and before any trace. ongoing actions (such as processing a console command or an http request). Everything is usually registered there - it's ok.
Look for a slim lifecycle-like "hook".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question