Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Rethinkdb Bundle Laravel Package

youdot/rethinkdb-bundle

Symfony bundle that integrates RethinkDB with PHP applications, offering configurable connections, service container wiring, and convenient access to the RethinkDB PHP driver for building realtime, scalable data features.

View on GitHub
Deep Wiki
Context7

Getting Started

This bundle is a thin Symfony 4 wrapper around a PHP RethinkDB driver. It registers a connection service from DI config rather than providing an ORM, repository layer, or migrations. First steps:

  1. composer require youdot/rethinkdb-bundle
  2. Register the bundle in config/bundles.php (Symfony 4 flex — the bundle's recipe may not exist, so add it manually):
    Youdot\RethinkDBBundle\YoudotRethinkDBBundle::class => ['all' => true],
    
  3. Publish/author your config at config/packages/youdot_rethinkdb.yaml. Exact keys depend on the bundle's DependencyInjection/Configuration.php, but expect the obvious set:
    youdot_rethinkdb:
        host: '%env(RETHINKDB_HOST)%'
        port: 28015
        database: '%env(RETHINKDB_DB)%'
        auth_key: '%env(RETHINKDB_AUTH_KEY)%'
        timeout: 5
    
  4. Inject the connection service (check Resources/config/services.xml for the exact service id — commonly youdot_rethinkdb or RethinkDB\Connection) into a controller or command and run your first query:
    $result = $this->r
        ->table('users')
        ->filter(['active' => true])
        ->limit(10)
        ->run($this->connection);
    

Where to look first: the bundle is small. Read, in order: DependencyInjection/Configuration.php (what config it actually accepts), DependencyInjection/*Extension.php (how the service is constructed), and Resources/config/services.xml (the service id and class). There is no documentation beyond that — the bundle is its source. For query syntax, go to the upstream PHP driver's README (dukun/rethinkdb, mabe/rethinkdb, or whichever it wraps) and to the RethinkDB JS/Python docs, since the ReQL API is consistent across languages.

First real use case: reading from a RethinkDB table you already populate elsewhere, or a small internal admin/metrics page. This bundle is not the tool to reach for if you need entity mapping — you will be writing ReQL by hand.

Implementation Patterns

Repository-style wrapper. Don't inject the connection into controllers. Wrap it:

final class UserRepository
{
    public function __construct(private Connection $connection) {}

    public function activeUsers(): array
    {
        return $this->connection->run(
            r\table('users')->filter(['active' => true])
        )->toArray();
    }
}

This keeps the ReQL surface in one place and makes it mockable when you swap the driver later.

Connection lifecycle. The bundle builds one connection at container boot. For long-running workers (Symfony Messenger, bin/console loops) that's usually fine, but you should verify reconnection behavior — RethinkDB sockets drop and the upstream PHP drivers historically don't auto-reconnect. Pattern: a small ConnectionManager that catches RethinkDB\Exceptions\*, closes, and rebuilds. Register it as a service and inject that instead of the raw connection in workers.

Changefeeds for event-driven bits. RethinkDB's real differentiator is changes(). The bundle itself does nothing special here — you drive the cursor yourself from a Console command pumped by Messenger or a supervisor:

$cursor = r\table('orders')->changes(['include_initial' => false])->run($conn);
foreach ($cursor as $change) { /* dispatch a message */ }

Keep it in a dedicated command; do not attempt this inside a HTTP request.

Schema bootstrap. There is no migration tooling. Use a rethink:init console command in your app that calls tableCreate, indexCreate, and indexWait, and make it idempotent (check tableList first). Run it in deploy, not in tests.

Testing. Because the bundle only provides a connection, the fastest test path is a real RethinkDB in Docker (rethinkdb:2.4) on a per-test database name, truncated between tests. Mocking ReQL chain objects is not worth the effort — the fluent API is large and mocking it produces brittle tests.

Integration with Symfony caching/serializers. RethinkDB returns associative arrays, not entities. Serialize with the Symfony Serializer by normalizing to DTOs in your repository layer, not by passing raw results to JsonResponse.

Gotchas and Tips

Maintenance risk is the top line. Zero stars, zero dependents, and a dependency on RethinkDB — a database whose company folded in 2016 and which is now community-maintained. Treat this bundle as pinned infrastructure: lock the exact version, vendor it if necessary, and assume you may have to replace it with a direct dependency on the underlying PHP driver. That swap is small (it's a one-service bundle) but budget for it.

Symfony 4 only. The bundle's service definitions and Configuration tree will not work unchanged on Symfony 6+. If you're on a newer Symfony, check whether it loads under the compatibility layer; often it does not, because of TreeBuilder signature changes and deprecated service definitions. Plan to fork and modernize.

PHP driver version drift. RethinkDB's PHP driver situation is fragmented (dukun/rethinkdb, mabe/rethinkdb, older rethinkdb/rethinkdb). Whichever this bundles may be unmaintained and may not support PHP 8.x's stricter type handling or socket extension behavior. Verify composer why youdot/rethinkdb-bundle and check the actual driver's last commit before committing.

Connection errors surface late. Because the connection is lazy in most PHP drivers, a bad host/port won't fail at container boot — it fails on the first query, deep in a request. Add a health-check console command that runs r\now()->run($conn) and wire it into your readiness probe.

No connection pooling. PHP's request-per-process model means one connection per request. RethinkDB holds a socket per connection; watch rethinkdb.stats under load. For high-throughput paths, batch queries with r\expr([...]) and do rather than issuing many round-trips.

Indexes are explicit, and missing ones fail silently-ish. filter on a non-indexed field does a table scan without a warning. Use getAll against secondary indexes for lookups, and run indexWait after indexCreate in the bootstrap command or your first read may miss the index.

Config quirks to check in Configuration.php: whether database is required vs defaulted, whether auth_key is nullable and defaults to empty string (some drivers treat null differently from ''), and the timeout unit (seconds vs milliseconds varies by driver). Env-var interpolation for auth_key commonly breaks if the var is unset — supply a default.

Extension point: the bundle exposes almost nothing beyond the connection service. If you need retry, logging, or a profiler panel, decorate the service in your app's services.yaml (decorates: youdot_rethinkdb) rather than editing the bundle — you'll want that seam when you eventually replace it.

Debugging ReQL. ->run($conn, ['profile' => true]) returns timing info in the result envelope on supported versions. For query-shape problems, the RethinkDB web admin (port 8080) shows the slow-query log; use it — the PHP driver gives poor error context on its own.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator