Weave Code
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

Singlestoredb Laravel Laravel Package

singlestoredb/singlestoredb-laravel

Official SingleStoreDB driver for Laravel. Wraps Laravel’s MySQL support to improve compatibility and add SingleStore features: Eloquent/migration extensions (columnstore/rowstore, shard/sort keys, etc.), JSON column support, query fixes, and tested across PHP/Laravel versions.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Strengths:

    • SingleStoreDB Optimization: The driver extends Laravel’s native MySQL support to fully leverage SingleStoreDB’s unique features (e.g., Universal Storage, sharding, sort keys, sparse columns). This aligns well with applications requiring hybrid transactional/analytical workloads or real-time analytics.
    • Eloquent Integration: Seamless compatibility with Laravel’s ORM, enabling SingleStoreDB-specific features (e.g., shardKey(), sortKey()) via fluent migration syntax. Reduces boilerplate for schema design.
    • Performance Focus: Built-in support for persistent connections (PDO::ATTR_PERSISTENT) and SSL/TLS optimizations, critical for high-throughput applications.
    • Feature Parity: Covers advanced SingleStoreDB constructs (e.g., reference tables, global temp tables, computed columns) that aren’t natively supported in Laravel’s MySQL driver.
  • Weaknesses:

    • Limited Query Builder Support: Some Laravel query builder methods (e.g., ORDER BY in DELETE/UPDATE) may not translate directly to SingleStoreDB syntax, requiring configuration overrides (e.g., ignore_order_by_in_deletes).
    • PHP 8.1+ Dependency: Workarounds (e.g., attribute casting) are needed for pre-8.1 environments due to PDO::ATTR_EMULATE_PREPARES bugs, adding complexity.
    • No Active Dependents: Lack of adoption (0 dependents) suggests unproven real-world stability, though this could reflect niche use cases.

Integration Feasibility

  • Laravel Ecosystem Fit: Designed as a drop-in replacement for Laravel’s MySQL driver, with minimal changes required to config/database.php. Supports queue failed jobs and migrations out of the box.
  • SingleStoreDB Compatibility: Validated against SingleStoreDB’s MySQL wire protocol, ensuring compatibility with existing Laravel applications migrating to SingleStoreDB.
  • Extension Points: Allows customization via connection options (e.g., SSL, persistent connections), accommodating enterprise-grade deployments (e.g., SingleStore Managed Service).

Technical Risk

  • Query Translation Risks:
    • Non-standard SQL features (e.g., ORDER BY in DELETE) may break without explicit configuration.
    • Complex joins or subqueries might require manual SQL overrides due to SingleStoreDB’s optimizations (e.g., sharding).
  • Performance Pitfalls:
    • Misconfigured shard keys or sort keys could degrade query performance (e.g., full table scans).
    • Persistent connections may cause issues in shared hosting or multi-tenant environments if not managed properly.
  • Migration Complexity:
    • Existing Laravel applications using MySQL-specific features (e.g., ORDER BY in updates) may need refactoring.
    • Schema changes (e.g., adding shardKey) require downtime or careful backfilling.

Key Questions

  1. Workload Alignment:
    • Is the application’s primary use case transactional, analytical, or hybrid? SingleStoreDB’s strengths vary by workload (e.g., Universal Storage for mixed workloads, Rowstore for OLTP).
  2. Schema Design:
    • Are there existing tables with shard keys, sort keys, or sparse columns that need to be migrated? How will data be redistributed?
  3. Performance Requirements:
    • Will persistent connections be enabled? If so, how will connection pooling and cleanup be managed in a Laravel queue worker or cron context?
  4. Compatibility:
    • Are there Laravel packages (e.g., Scout, Cashier) that rely on MySQL-specific behavior? Will they work with SingleStoreDB?
  5. Observability:
    • How will query performance and SingleStoreDB-specific metrics (e.g., segment rows, shard distribution) be monitored?
  6. Rollback Plan:
    • What’s the strategy for reverting to MySQL if SingleStoreDB integration fails (e.g., during a migration)?

Integration Approach

Stack Fit

  • Laravel Versions: Tested against a matrix of PHP/Laravel versions (implied by CI/CD), but explicit version support should be confirmed (e.g., Laravel 10, PHP 8.2).
  • SingleStoreDB Modes:
    • SingleStoreDB Managed Service: Requires SSL certificate handling (e.g., singlestore_bundle.pem).
    • Self-Hosted SingleStoreDB: Supports all features, including custom sharding strategies.
  • Complementary Tools:
    • Laravel Scout: May need adjustments for SingleStoreDB’s full-text search (e.g., FULLTEXT indexes).
    • Laravel Echo/Pusher: Works if using SingleStoreDB’s MySQL compatibility layer for pub/sub.

Migration Path

  1. Pilot Phase:
    • Start with a non-critical service or read-replica to test the driver.
    • Migrate a subset of tables (e.g., analytical tables to Universal Storage, OLTP tables to Rowstore).
  2. Configuration:
    • Update config/database.php to use the singlestore driver.
    • Configure connection options (e.g., PDO::ATTR_PERSISTENT, SSL) based on deployment.
  3. Schema Adaptation:
    • Use the driver’s migration helpers (e.g., shardKey(), sortKey()) to define SingleStoreDB-specific optimizations.
    • Gradually migrate tables, monitoring performance (e.g., query latency, shard distribution).
  4. Application-Level Changes:
    • Disable ORDER BY in DELETE/UPDATE queries if needed (via connection config).
    • Update queries using MySQL-specific features (e.g., LIMIT with ORDER BY in updates).
  5. Cutover:
    • Use Laravel’s database migrations to sync schema changes.
    • For zero-downtime migrations, consider dual-write patterns (write to both MySQL and SingleStoreDB temporarily).

Compatibility

  • Laravel Features:
    • Eloquent: Fully supported, including relationships, accessors, and mutations.
    • Query Builder: Most methods work, but some require configuration (e.g., ignore_order_by_in_updates).
    • Migrations: Extended with SingleStoreDB-specific syntax (e.g., reference(), global()).
  • Third-Party Packages:
    • Packages relying on raw MySQL queries (e.g., laravel-debugbar) may need patches.
    • Testing: Use Laravel’s DatabaseMigrations or DatabaseTransactions fixtures to validate compatibility.
  • Edge Cases:
    • JSON Columns: Supported, but behavior may differ from MySQL (e.g., indexing).
    • Transactions: SingleStoreDB supports distributed transactions (XA), but Laravel’s default transaction handling should suffice for most use cases.

Sequencing

  1. Phase 1: Infrastructure Setup
    • Deploy SingleStoreDB cluster (Managed Service or self-hosted).
    • Configure Laravel to use the new driver (update config/database.php).
  2. Phase 2: Schema Migration
    • Identify tables for migration (prioritize analytical or high-growth tables).
    • Use the driver’s migration helpers to define SingleStoreDB-specific optimizations.
  3. Phase 3: Application Testing
    • Test CRUD operations, queries, and migrations.
    • Validate performance (e.g., query execution time, connection handling).
  4. Phase 4: Cutover
    • Migrate data (use mysqldump or Laravel’s migrations for schema + data).
    • Update DNS or load balancers to point to SingleStoreDB.
  5. Phase 5: Optimization
    • Tune shard keys, sort keys, and segment sizes based on workload.
    • Monitor and adjust connection pooling (e.g., persistent connections).

Operational Impact

Maintenance

  • Driver Updates:
    • Monitor the package for updates (last release: 2026-03-27) and align with Laravel/SingleStoreDB version support.
    • Contribute to or fork the package if critical bugs are found (low stars suggest community involvement may be limited).
  • Schema Management:
    • SingleStoreDB-specific features (e.g., shardKey) add complexity to schema changes. Document these in migration files or a central schema registry.
    • Use Laravel’s Schema::hasTable() and Schema::hasColumn() for idempotent migrations.
  • Dependency Management:
    • Ensure pdo_mysql is installed and compatible with the PHP version.
    • Pin Laravel and PHP versions to avoid compatibility issues.

Support

  • Troubleshooting:
    • Connection Issues: Verify SSL certificates, network latency, and SingleStoreDB cluster health.
    • Query Failures: Check SingleStoreDB logs for syntax errors (e.g., unsupported ORDER BY clauses).
    • Performance Issues: Use SingleStoreDB’s EXPLAIN and SHOW TABLE STATUS to diagnose slow queries or suboptimal sharding.
  • Community Resources:
    • Limited stars/dependents may require reaching out to SingleStoreDB’s official support or community Slack/Discord.
    • Refer to Single
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport