-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add sanitizers which cast to common data types #2
Comments
Great idea! 😄 Have you implemented these sanitizers in your own project already? If so, feel free to submit them in a pull-request and I will consider including them in the default sanitizers. |
@arondeparon I would be interested in casting, however are these filters? I'm happy to make a PR for it. See examples given by Waavi: https://github.com/Waavi/Sanitizer/blob/master/src/Filters/Cast.php |
@francoism90 looks like an interesting solution! :) I could imagine doing something like this: protected $sanitizers = [
'amount' => [
Cast::class => [
'to' => Cast::CAST_TYPE_FLOAT,
]
]
]; |
@arondeparon That looks cool! I'll take a look at your example and try to implement it. :) |
Good luck! You might be able to draw some inspiration from the |
Basically, implement casting to bool, int, float, string (this would likely just do nothing), and maybe dates to Carbon instances?
The text was updated successfully, but these errors were encountered: