PHPackages                             makinacorpus/goat-query-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. makinacorpus/goat-query-bundle

ActiveLibrary[Database &amp; ORM](/categories/database)

makinacorpus/goat-query-bundle
==============================

Symfony bundle for makinacorpus/goat-query

3.1.7(3y ago)08.6k↓50%[2 issues](https://github.com/pounard/goat-query-bundle/issues)5GPL-2.0-or-laterPHPPHP &gt;=7.4

Since May 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/pounard/goat-query-bundle)[ Packagist](https://packagist.org/packages/makinacorpus/goat-query-bundle)[ Docs](http://github.com/pounard/goat-query-bundle)[ RSS](/packages/makinacorpus-goat-query-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (13)Versions (18)Used By (5)

Goat Query Symfony bundle
=========================

[](#goat-query-symfony-bundle)

This packages provides autoconfiguration and integration of [makinacorpus/goat-query](https://github.com/pounard/goat-query)for the Symfony framework.

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

[](#installation)

```
composer req makinacorpus/goat-query-bundle
```

Then add the following bundles into your Symfony `config/bundles.php` file:

```
return [
    // Your bundles...
    Goat\Query\Symfony\GoatQueryBundle::class => ['all' => true],
];
```

Usage
=====

[](#usage)

If everything was successfuly configured, you may use one of the following classes in dependency injection context (ie. services constructor arguments or controllers action methods parameters):

- `Goat\Runner\Runner` gives you a runner instance plugged onto the default Doctrine DBAL connection,
- `Goat\Query\QueryBuilder` gives you a query factory instance.

Configuration
=============

[](#configuration)

Manual configuration (standalone)
---------------------------------

[](#manual-configuration-standalone)

Manually configuring your connections is as simple as:

```
parameters:
    env(DATABASE_URL): 'pgsql://username:password@host:5432/database'
    env(DATABASE_URL_OTHER): 'pgsql://username:password@host:5432/other'
goat_query:
    runner:
        default:
            url: '%env(resolve:DATABASE_URL)%'
        other:
            url: '%env(resolve:DATABASE_URL_OTHER)%'
```

Automatic configuration (side by side with Doctrine)
----------------------------------------------------

[](#automatic-configuration-side-by-side-with-doctrine)

Per default, if you installed and configured Doctrine in Symfony, this bundle will create one runner per Doctrine connexion, re-using Doctrine DBAL PDO connexion for each one, sharing its sessions.

Considering the following Doctrine configuration:

```
doctrine:
    dbal:
        url: '%env(resolve:DATABASE_URL)%'
```

You will obtain a single `Goat\Runner\Runner` instance in the container, named `goat.runner.default`.

Using a more advanced configuration, such as:

```
doctrine:
    dbal:
        connections:
            default:
                url: '%env(resolve:DATABASE_URL)%'
            logging:
                url: '%env(resolve:DATABASE_URL)%'
```

You will obtain 2 different runners:

- `goat.runner.default`
- `goat.runner.logging`

No further configuration is required.

Advanced configuration
======================

[](#advanced-configuration)

Runners
-------

[](#runners)

A runner is a connection, you may have one or more. Per default, you should always configure the `default` connection.

### Re-using a Doctrine connection

[](#re-using-a-doctrine-connection)

```
goat_query:
    runner:
        default:
              doctrine_connection: default
              driver: doctrine
              metadata_cache: apcu
              metadata_cache_prefix: "%goat.runner.metadata_cache_prefix%"
    query:
        enabled: true
```

### Using the ext-pgsql driver

[](#using-the-ext-pgsql-driver)

```
goat_query:
    runner:
        default:
              driver: ext-pgsql
              url: '%env(resolve:DATABASE_URL)%'
        logging:
              driver: ext-pgsql
              url: '%env(resolve:DATABASE_URL)%'
```

You will notice that for `ext-pgsl` we do not configure a metadata cache, because `ext-pgsql` is very fast and using APCu to store metadata doesn't bring any performance boost (it would slower the runner actually).

### Using &lt;any&gt; driver

[](#using-any-driver)

The previous section works for any driver, just replace all `ext-pgsql` section by any of:

- `ext-pgsql` : for PostgreSQL via PHP `ext-pgsql`,
- `pdo-pgsql` : for PostgreSQL via `PDO`,
- `pgsql` : for PostgreSQL via driver autoselection (`ext-pgsql` is prefered),
- `pdo-mysql` : for MySQL via `PDO`,
- `mysql` : for MySQL via driver autoselection (only `PDO` is supported right now).

### More than one database connexion

[](#more-than-one-database-connexion)

```
goat_query:
    runner:
        default:
              doctrine_connection: default
              driver: doctrine
              metadata_cache: apcu
              metadata_cache_prefix: "%goat.runner.metadata_cache_prefix%"
        some_business_connection:
              driver: ext-pgsql
              url: '%env(resolve:ANOTHER_DATABASE_URL)%'
        logging:
              autocommit: true
              doctrine_connection: another_connnection
              driver: doctrine
              metadata_cache: apcu
              metadata_cache_prefix: "%goat.runner.metadata_cache_prefix%"
    query:
        enabled: true
```

The `default` runner is the one that per default will be injected into services using the `\Goat\Runner\Runner` interface as type-hint when using autowiring.

In order to inject a specific runner, you may use the `goat.runner.NAME` service identifier, in the above example, you would have the following two services available:

- `goat.runner.default`, the default one,
- `goat.runner.logging`, the other one.

Driver configuration
--------------------

[](#driver-configuration)

Read the `` file in this package for more information.

@todo

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~62 days

Recently: every ~33 days

Total

17

Last Release

1180d ago

Major Versions

2.0.x-dev → 3.0.02020-12-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/d21b98752b406528da88850922b1061f39bf72eb2126b413d5c12e275811a40b?d=identicon)[Makina Corpus](/maintainers/Makina%20Corpus)

---

Top Contributors

[![pounard](https://avatars.githubusercontent.com/u/341855?v=4)](https://github.com/pounard "pounard (26 commits)")

---

Tags

symfonydatabaseormmysqlpostgresqlpdo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/makinacorpus-goat-query-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/makinacorpus-goat-query-bundle/health.svg)](https://phpackages.com/packages/makinacorpus-goat-query-bundle)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[cycle/database

DBAL, schema introspection, migration and pagination

64690.9k31](/packages/cycle-database)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

845.7k](/packages/tommyknocker-pdo-database-class)[ramadan/easy-model

A Laravel package for enjoyably managing database queries.

101.6k](/packages/ramadan-easy-model)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
