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
Cockroachdb Laravel

Cockroachdb Laravel Laravel Package

ylsideas/cockroachdb-laravel

CockroachDB driver for Laravel that enables using CockroachDB with Eloquent, migrations, and schema builder. Connect Laravel apps to distributed SQL while keeping familiar database workflows and configuration.

View on GitHub
Deep Wiki
Context7

A driver for compatibility between Laravel and CockroachDB

Frequently asked questions about Cockroachdb Laravel
What is ylsideas/cockroachdb-laravel and what does it do?
It is a Laravel database driver that adds compatibility between Laravel and CockroachDB, a distributed SQL database. It plugs into Laravel's native database abstraction layer so Eloquent models, the query builder, migrations, and schema builder operations can target CockroachDB. You still configure a normal Laravel connection, but the underlying driver speaks CockroachDB. It is aimed at teams that have deliberately chosen CockroachDB for multi-region, horizontally scalable deployments.
How do I install and configure the CockroachDB driver in Laravel?
Install it with Composer using composer require ylsideas/cockroachdb-laravel, then publish the package configuration if the service provider requires it. Add a database connection entry in config/database.php pointing at your CockroachDB host, port, database, and credentials, and set the driver to the one this package registers. After that you can run php artisan migrate and use Eloquent as usual. For greenfield projects the setup is straightforward; for existing apps, validate against a staging CockroachDB cluster first.
Which Laravel versions does this package support?
Version 1.4.0 explicitly adds Laravel 11 support, which is the current major release at the time of that release. Earlier releases such as 1.3.0 presumably targeted Laravel 10 and below, so the 1.4.0 bump likely drops support for older Laravel versions. If you are on Laravel 10 or earlier, you should confirm the supported constraint in the package's composer.json before upgrading. Teams not yet on Laravel 11 may need to upgrade Laravel first or stay on the previous package release.
Which CockroachDB versions are supported and tested by this driver?
The provided documentation does not list an explicit, officially tested CockroachDB version range. Because CockroachDB evolves its SQL compatibility and transaction semantics across releases, you should verify compatibility against your target cluster version in staging. Check the repository's release notes and issue tracker for any version-specific reports. Treat version support as something to confirm rather than assume.
Can I use Eloquent relationships and migrations normally with CockroachDB?
Eloquent and the schema builder work through this driver, but Laravel's ORM and migration system were not designed with distributed SQL in mind. Foreign key enforcement, schema change behavior, and certain migration operations can differ from MySQL or PostgreSQL, so migrations should be tested carefully against a real CockroachDB cluster. Relationships generally work, but subtle differences can appear in edge cases. Validate your most complex queries and schema changes in staging before relying on them in production.
How does the package handle CockroachDB transaction retries and serialization errors?
CockroachDB runs at serializable isolation and can return retry errors under contention, which is a different model from typical MySQL or PostgreSQL defaults. The package bridges Laravel's database layer to CockroachDB, but Laravel's default transaction handling does not automatically account for distributed SQL retry semantics. You should review how your application wraps transactions and be prepared to implement retry logic where needed. Test contention-heavy paths explicitly rather than assuming retries are handled for you.
Should I use CockroachDB instead of MySQL or PostgreSQL for a Laravel app?
Only if you specifically need CockroachDB's distributed capabilities such as multi-region active-active deployments, geo-partitioning, strong consistency, and elastic horizontal scaling. For single-region or low-scale Laravel applications, the added operational complexity is usually unjustified and standard MySQL or PostgreSQL is the safer default. This driver makes CockroachDB usable from Laravel, but it does not remove the impedance mismatch between distributed SQL and Laravel's ORM assumptions. Adopt it as a deliberate architectural choice, not as a drop-in replacement.
What are the risks of using third-party Laravel packages with CockroachDB?
Packages that interact directly with the database layer, such as permission systems, audit loggers, and queue or session drivers, may not have been tested against CockroachDB. They often rely on SQL features, locking behavior, or transaction assumptions that can differ under distributed SQL. Run a full integration test pass on your package set before committing to CockroachDB. Identify database-touching dependencies early so surprises surface in staging rather than production.
How do I upgrade from v1.3.0 to v1.4.0 or migrate an existing Laravel app to CockroachDB?
These are two separate efforts. Upgrading the package is a Composer update, but v1.4.0 requires Laravel 11, so upgrade Laravel first following its official guide and then update the package, retesting database interactions because Laravel 11 changed several database-related defaults. Migrating an existing application from PostgreSQL or another database to CockroachDB is a larger project involving schema conversion, data migration, and query rewrites, especially around transactions. Do the package upgrade and the database migration in sequence, and validate everything in staging before touching production.
Is ylsideas/cockroachdb-laravel actively maintained, and what are the alternatives?
The package appears to be community-maintained with a small contributor base, and the Laravel 11 support in v1.4.0 is a positive maintenance signal, though long-term support is not guaranteed. There is no widely established first-party CockroachDB driver from Laravel itself, so alternatives generally mean building your own connection driver or adapting an existing PostgreSQL-based connection with your own compatibility layer. Review recent commit activity, open issues, and release cadence before adopting it for a long-lived project. Pinning a known-good version and tracking the repository is a sensible risk mitigation.
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.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager