ThomasMcDonald
ThomasMcDonald

Reputation: 323

Laravel HTML and SQL sanitisation

What are the appropriate ways to do HTML sanitisation and SQL sanitisation in Laravel 4?

Upvotes: 0

Views: 204

Answers (1)

Kirk Beard
Kirk Beard

Reputation: 9843

SQL sanitisation is handled automatically. From the docs:

Note: The Laravel query builder uses PDO parameter binding throughout to protect your application against SQL injection attacks. There is no need to clean strings being passed as bindings.

Blade templates automatically escape variables when using curly brackets, e.g. {{ $var }}. If you do not want to escape the HTML, you need to use {!! $var !!} instead.

Upvotes: 1

Related Questions