Download the PHP package omaresmael/laravel-query-optimizer without Composer
On this page you can find all versions of the php package omaresmael/laravel-query-optimizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download omaresmael/laravel-query-optimizer
More information about omaresmael/laravel-query-optimizer
Files in omaresmael/laravel-query-optimizer
Package laravel-query-optimizer
Short Description An AI powered optimizer for laravel eloquent and query builder
License MIT
Homepage https://github.com/omaresmael/laravel-query-optimizer
Informations about the package laravel-query-optimizer
laravel-query-optimizer
Optimize laravel DB or eloquent read queries using openAI API, and get insights on how you can make your queries faster
Installation
First, install the package using composer
Then, publish openAI configuration file
Lastly, add the openAPI key to your .env
file
and that's it, you are ready to go
Usage
this package can help you optimize your eloquent or DB queries using openAI
the package has the following methods
optimize()
This method is responsible for optimizing the query and return an instance of the Optimizer
class.
toSql()
this method will return the optimized query as a string
get()
this method will run the optimized query that is generated by optimize()
method and return the result
⚠️ make sure to know the query you are running before using this method, as it will run the optimized query and not the original query
explain()
this method will return a key-value array that contains the optimized query, the reasoning behind performing such optimization, and suggestions to manually optimize the query even further
the array format will be
Credits
License
The MIT License (MIT). Please see License File for more information.
Inspiration
This package is inspired by laravel-ask-database package
Thanks for the great work Marcel Pociot