PHPackages                             zjkiza/sql-twig-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. zjkiza/sql-twig-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

zjkiza/sql-twig-bundle
======================

The bundle executes raw SQL queries with the flexibility to embed Twig extensions, enabling the dynamic creation of queries using Twig syntax.

v0.10.1(3mo ago)211MITPHPPHP &gt;=8.1

Since May 8Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/zjkiza/sql-twig-bundle)[ Packagist](https://packagist.org/packages/zjkiza/sql-twig-bundle)[ RSS](/packages/zjkiza-sql-twig-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (25)Versions (10)Used By (0)

Sql Twig Bundle
===============

[](#sql-twig-bundle)

The bundle executes raw SQL queries with the flexibility to embed Twig extensions, enabling the dynamic creation of queries using Twig syntax.

About the bundle
================

[](#about-the-bundle)

- You can use Twig syntax when creating queries.
- You place queries in separate files. (Ex: all\_media.sql.twig).
- Execute your queries using `Zjk\SqlTwig\Contract\SqlTwigInterface` service.
- Result of execution `Zjk\SqlTwig\Contract\SqlTwigInterface->executeQuery(..)` is instance of Doctrine\\DBAL\\Driver\\Result, use their methods to get results.
- Query execution via transaction `Zjk\SqlTwig\Contract\SqlTwigInterface->transaction(..)`
- Create `Zjk\SqlTwig\Contract\SqlTwigInterface->registerTempTable(..)` and execute `Zjk\SqlTwig\Contract\SqlTwigInterface->executeQueryWithTempTable(..)` queries with temporary table.

Installation
============

[](#installation)

Add "zjkiza/sql-twig-bundle" to your composer.json file:

```
composer require zjkiza/sql-twig-bundle

```

Symfony integration
-------------------

[](#symfony-integration)

Bundle wires up all classes together and provides method to easily setup.

1. Register bundle within your configuration (i.e: `bundles.php`).

    ```
