PHPackages                             bernard/bernard-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. [Queues &amp; Workers](/categories/queues)
4. /
5. bernard/bernard-bundle

ActiveSymfony-bundle[Queues &amp; Workers](/categories/queues)

bernard/bernard-bundle
======================

Integrates Bernard into a Symfony2 application.

v2.0.2(8y ago)95706.9k↑23.1%34[10 issues](https://github.com/bernardphp/BernardBundle/issues)[2 PRs](https://github.com/bernardphp/BernardBundle/pulls)3MITPHPPHP ^5.6|^7.0

Since Jan 24Pushed 4y ago4 watchersCompare

[ Source](https://github.com/bernardphp/BernardBundle)[ Packagist](https://packagist.org/packages/bernard/bernard-bundle)[ Docs](http://bernard.readthedocs.org/)[ RSS](/packages/bernard-bernard-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelog (9)Dependencies (5)Versions (12)Used By (3)

BernardBundle
=============

[](#bernardbundle)

Integrates Bernard neatly with a Symfony application.

[![Build Status](https://camo.githubusercontent.com/3dd117565adfb1b52c3eec3fe4d98eaf634b4131bf72e969e3b9307f74129afd/68747470733a2f2f7472617669732d63692e6f72672f6265726e6172647068702f4265726e61726442756e646c652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/bernardphp/BernardBundle)

Getting Started
---------------

[](#getting-started)

Everything starts by installing the bundle. This is done through composer by adding the following lines to your `composer.json` file and running `composer update bernard/bernard-bundle`.

```
{
    "require" : {
        "bernard/bernard-bundle" : "~1.0"
    }
}
```

Next up is adding the bundle to your kernel and configuring it in `config.yml`.

```
// app/AppKernel.php
// .. previous class definition
public function registerBundles()
{
    // .. all the other bundles you have registered.
    $bundles[] = new Bernard\BernardBundle\BernardBundle();
    // .. the rest of the method
}
```

```
# .. previous content of app/config/config.yml
bernard:
    driver: file # you can choose predis, phpredis, file, doctrine, sqs etc.
```

Great! You are now ready to use this diddy. Go and read the rest of the documentation on Bernard at [bernard.readthedocs.org](http://bernard.readthedocs.org).

### Running the Consumer

[](#running-the-consumer)

What good is a message queue if you don't know how to run the consumer? Luckily this bundle auto registers the commands with your application. So if you run `php app/console` you should see `bernard:consume` and `bernard:produce`. These work just as the documentation describes but if you are in doubt just add `--help` when running the command.

It is important to use `--no-debug` when running the consumer for longer periods of time. This is because Symfony by default in debug mode collects a lot of information and logging and if this is omitted you will run into memory problems sooner or later.

### Adding Receivers

[](#adding-receivers)

In order to know what messages needs to go where you have to register some receivers. This is done with a tag in your service definitions.

```
my_receiver:
    class: Acme\Receiver
    # public: true # Make sure the service is public
    tags:
         - { name: bernard.receiver, message: SendNewsletter }
         - { name: bernard.receiver, message: ImportUsers }
```

As the example shows it is possible to register the same receiver for many different message types.

Configuration Options
---------------------

[](#configuration-options)

There are different options that can be set that changes the behaviour for various drivers.

### Doctrine

[](#doctrine)

When using the doctrine driver it can be useful to use a seperate connection when using Bernard. In order to change it use the `connection` option. This also needs to be set if you default connection is called anything else than `default`.

```
doctrine:
    dbal:
        connections:
            bernard:
                host:     "%database_host%"
                charset:  UTF8

bernard:
    driver: doctrine
    options:
        connection: bernard # default is the default value
```

### FlatFile

[](#flatfile)

The file driver needs to know what directory it should use for storing messages and its queue metadata.

```
bernard:
    driver: file
    options:
        directory: %kernel.cache_dir%/bernard
```

The above example will dump your messages in the cache folder. In most cases you will want to change this to something because the cache folder is deleted every time the cache is cleared (obviously).

### PhpAmqp / RabbitMQ

[](#phpamqp--rabbitmq)

PhpAmqp depends on a service called `old_sound_rabbit_mq.connection.default` with a configured connection instance that extends `\PhpAmqpLib\Connection\AbstractConnection` class. If you want to use a different name use the `phpamqp_service` option:

```
bernard:
    driver: phpamqp
    options:
        phpamqp_service: my_phpamqp_service
```

You need to define the `phpamqp_exchange`. Optional, you can define `phpamqp_default_message_parameters`:

```
bernard:
    driver: phpamqp
    options:
        phpamqp_exchange: my_phpamqp_service
        phpamqp_default_message_parameters:
            content_type: application/json
            delivery_mode: 2
```

### PhpRedis

[](#phpredis)

PhpRedis depends on a service called `snc_redis.bernard` with a configured `Redis` instance. If you want to use a different name use the `phpredis_service` option:

```
bernard:
    driver: phpredis
    options:
        phpredis_service: my_redis_service
```

If you're using the [SncRedisBundle](https://github.com/snc/SncRedisBundle) you have to set logging to false for the bernhard client to ensure that is is a `Redis` instance and not wrapped. Also, if the consumer is throwing `RedisException: read error on connection`, you need to set `connection_timeout` (see SncRedisBundle configuration options) option to a value higher than 5 (seconds).

### IronMQ

[](#ironmq)

When using the IronMQ driver you have to configure an `IronMQ` connection instance. You can configure it like the following:

```
services:
    ironmq_connection:
        class: IronMQ
        arguments:
            - { token: %ironmq_token%, project_id: %ironmq_project_id% }
        public: false

bernard:
    driver: ironmq
    options:
        ironmq_service: ironmq_connection
```

### Amazon SQS

[](#amazon-sqs)

To use Amazon SQS, configure your driver like this:

```
services:
    my_sqs_client:
        class: Aws\Sqs\SqsClient
        factory: Aws\Sqs\SqsClient::factory
        arguments:
            region: "your aws region" # e.g. "eu-west-1"
            key: "your aws user's key"
            secret: "your aws user's secret"

bernard:
    driver: sqs
    options:
        sqs_service: my_sqs_client
        sqs_queue_map: # optional for aliasing queue urls (default alias is the url section after the last "/"), e.g.:
            send_newsletter: https://sqs.eu-west-1.amazonaws.com/...
        prefetch: 1 # optional, but beware the default is >1 and you may run into invisibility timeout problems with that
```

### Pheanstalk

[](#pheanstalk)

To use Pheanstalk (pda/pheanstalk), configure your driver like this:

```
services:
    my.pheanstalk.connection:
        class: Pheanstalk\Pheanstalk
        arguments:
            - %some.parameter.containing.pheanstalk.host%

bernard:
    driver: pheanstalk
    options:
        pheanstalk_service: my.pheanstalk.connection
```

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity53

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~148 days

Recently: every ~105 days

Total

10

Last Release

3204d ago

Major Versions

1.1.2 → 2.0.0-alpha12016-07-29

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19725?v=4)[Henrik Hauge Bjørnskov](/maintainers/henrikbjorn)[@henrikbjorn](https://github.com/henrikbjorn)

---

Top Contributors

[![henrikbjorn](https://avatars.githubusercontent.com/u/19725?v=4)](https://github.com/henrikbjorn "henrikbjorn (66 commits)")[![acrobat](https://avatars.githubusercontent.com/u/1374857?v=4)](https://github.com/acrobat "acrobat (38 commits)")[![MalteWunsch](https://avatars.githubusercontent.com/u/2504942?v=4)](https://github.com/MalteWunsch "MalteWunsch (20 commits)")[![hacfi](https://avatars.githubusercontent.com/u/428841?v=4)](https://github.com/hacfi "hacfi (8 commits)")[![lakiboy](https://avatars.githubusercontent.com/u/1089265?v=4)](https://github.com/lakiboy "lakiboy (7 commits)")[![ruudk](https://avatars.githubusercontent.com/u/104180?v=4)](https://github.com/ruudk "ruudk (6 commits)")[![karser](https://avatars.githubusercontent.com/u/1675033?v=4)](https://github.com/karser "karser (2 commits)")[![johanderuijter](https://avatars.githubusercontent.com/u/1373219?v=4)](https://github.com/johanderuijter "johanderuijter (1 commits)")[![danydev](https://avatars.githubusercontent.com/u/2708453?v=4)](https://github.com/danydev "danydev (1 commits)")[![bendavies](https://avatars.githubusercontent.com/u/625392?v=4)](https://github.com/bendavies "bendavies (1 commits)")[![mente](https://avatars.githubusercontent.com/u/391997?v=4)](https://github.com/mente "mente (1 commits)")[![sagikazarmark](https://avatars.githubusercontent.com/u/1226384?v=4)](https://github.com/sagikazarmark "sagikazarmark (1 commits)")[![samnela](https://avatars.githubusercontent.com/u/1852108?v=4)](https://github.com/samnela "samnela (1 commits)")[![sbacelic](https://avatars.githubusercontent.com/u/647434?v=4)](https://github.com/sbacelic "sbacelic (1 commits)")[![stephpy](https://avatars.githubusercontent.com/u/232744?v=4)](https://github.com/stephpy "stephpy (1 commits)")[![toin0u](https://avatars.githubusercontent.com/u/672421?v=4)](https://github.com/toin0u "toin0u (1 commits)")[![filipegarcia](https://avatars.githubusercontent.com/u/944138?v=4)](https://github.com/filipegarcia "filipegarcia (1 commits)")[![tompedals](https://avatars.githubusercontent.com/u/6132043?v=4)](https://github.com/tompedals "tompedals (1 commits)")[![holtkamp](https://avatars.githubusercontent.com/u/776405?v=4)](https://github.com/holtkamp "holtkamp (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bernard-bernard-bundle/health.svg)

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[symfony/web-profiler-bundle

Provides a development tool that gives detailed information about the execution of any request

2.3k160.5M1.2k](/packages/symfony-web-profiler-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[ecotone/symfony-bundle

Ecotone for Symfony — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Symfony Messenger, via PHP attributes.

11249.0k1](/packages/ecotone-symfony-bundle)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

9410.7k](/packages/ahmed-bhs-doctrine-doctor)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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