Download the PHP package zjkiza/sql-blade without Composer
On this page you can find all versions of the php package zjkiza/sql-blade. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zjkiza/sql-blade
More information about zjkiza/sql-blade
Files in zjkiza/sql-blade
Package sql-blade
Short Description The packages executes raw SQL queries with the flexibility to embed Blade extensions, enabling the dynamic creation of queries using Blade syntax.
License MIT
Informations about the package sql-blade
Sql Blade Package
The packages execute raw SQL queries which are in a separate file with the flexibility to embed Blade extensions, enabling the dynamic creation of queries using Blade syntax.
About the package
- You can use Blade syntax when creating queries.
- You place queries in separate files. (Ex:
select_user.blade.sql
). - Execute your queries using
Zjk\SqlBlade\Contract\SqlBladeInterface
service. - Result of execution
Zjk\SqlBlade\Contract\SqlBladeInterface->executeQuery(..)
is instance of Doctrine\DBAL\Driver\Result, use their methods to get results. - Query execution via transaction
Zjk\SqlBlade\Contract\SqlBladeInterface->transaction(..)
Installation
Add zjkiza/sql-blade
to your composer.json file:
A quick example
Working with the bundle
It is necessary to define which directory/directories will be used for storing files with sql queries.
In file config/view.php
add paths
Example:
Create a sql query (to the directory defined above). Example (select_user.blade.sql
):
Notice: At the end of the query, you must put ;
Working in php, Example:
Crafting intricate and sophisticated queries.
At times, it's essential to have the flexibility to construct your queries in accordance with the logic of your application. This is where the sqlBlade comes into play, leveraging Blade to pre-parse all your query resources. This enables you to dynamically shape your queries as needed.
Query logging
Executed queries are logged in laravel.log
file. In which there are:
- file name,
- sql query that was executed,
- arguments,
- argument types,
- query execution time in sec.
All versions of sql-blade with dependencies
doctrine/dbal Version ^2.0|^3.0
illuminate/support Version ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
illuminate/contracts Version ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0