Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

amarafif's avatar

Can RAW Queries in Laravel projects cause security issues?

Hello friends, I have a question to fix my laravel project. My current project has a performance issue that takes too long to load data when displaying the data in a chart. The chart I use is APEXCHART in filament. I got a suggestion to use RAW Query. But after I read, raw queries can cause vulnerabilities in the security of my information system. What do you think friends? Are there any more effective and safer steps? If there is, please share below... Thank you all

0 likes
3 replies
Tray2's avatar

Yes, a poorly written raw query might present a security threat, but as long as you don't run queries that takes unbound user input you should be ok.

1 like
Snapey's avatar

There are very few cases where a raw query woukd produce a faster result, but you try it, measure it, and then see if you can put it back to query builder.

Please or to participate in this conversation.