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

UzairAli's avatar

Creating Database Store Procedures and views and Their Usage in Laravel

Hi, I am Uzair Ali, recently I have read the article about Db 'Stored Procedures' and 'Views' that optimize the query speed. I want to know is there any feature in Laravel to create stored procedures and views in Db? Or in future this feature will be available?

1 like
3 replies
Tray2's avatar

Stored procedures no, but there are some packages that can help ypu with that, but I prefer writing my own views in the migrations, you can see an example one that here. I would not recommend using stored procedures though, they are most likely not the solution to your speed issues, a good query with the proper indexes is a bigger gain speedwise.

https://tray2.se/posts/use-a-view-instead-of-a-complex-eloquent-query-in-your-laravel-application

1 like
UzairAli's avatar

And what about security wise means it provide more security against SQL Injection

Please or to participate in this conversation.