Download the PHP package deflinhec/laravel-clickhouse without Composer
On this page you can find all versions of the php package deflinhec/laravel-clickhouse. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download deflinhec/laravel-clickhouse
More information about deflinhec/laravel-clickhouse
Files in deflinhec/laravel-clickhouse
Package laravel-clickhouse
Short Description Laravel ClickHouse integration package
License MIT
Informations about the package laravel-clickhouse
Laravel ClickHouse Package
Laravel ClickHouse integration package based on smi2/phpclickhouse client with advanced features including migration system, cluster support, and comprehensive exception handling.
- Vendor: deflinhec
- Package: laravel-clickhouse
- Composer:
composer require deflinhec/laravel-clickhouse
Features
- ๐ ClickHouse connection management with multiple connection support
- ๐ Migration system with Laravel integration
- ๐ Query builder and custom query execution
- ๐งช Testing tools and CLI interface
- ๐ Complete logging and monitoring
- โก High-performance query support
- ๐ Cluster mode with load balancing (round-robin, random, failover)
- ๐ก๏ธ Comprehensive exception handling with custom error types
- ๐ง Artisan commands for management and testing
- ๐ฆ Composer package with proper autoloading
PHP Compatibility
This package is compatible with:
- PHP 7.3+ (with full type hint support)
- Laravel 5.0+ through Laravel 12.0+
Installation
1. Install Package
2. Publish Configuration Files
3. Set Environment Variables
Add the following to your .env file:
Basic Usage
Service-based Approach
Exception Handling
The package provides a custom ClickHouseException class with comprehensive error types:
Artisan Commands
Interactive CLI
Connection Testing
Cluster Management
Migration Management
Migration System
Important Notes
ClickHouse migrations use Laravel's default migrations table to track migration status, rather than creating additional tables in ClickHouse. This ensures migration records are consistent with other Laravel migrations.
Creating Migration Files
Use the make:clickhouse-migration command to quickly create migration files:
Supported Field Types
The command supports the following field type mappings:
stringโStringint/integerโInt32bigintโInt64floatโFloat32doubleโFloat64decimalโDecimal(10,2)bool/booleanโUInt8dateโDatedatetime/timestampโDateTimearrayโArray(String)jsonโString
Manual Migration File Creation
Configuration
Connection Settings
Table Structure Examples
Basic Table
Standard ClickHouse table structure example:
Nested Data Type Example
Using ClickHouse's Nested data type to handle complex hierarchical structures:
Benefits include:
- More compact data structure, saving storage space
- More flexible queries (can use
has(),arrayJoin()and other ClickHouse strengths) - Easier analysis and maintenance of deep structures
Supported ClickHouse Functions
has()- Check if array contains specific valuearrayJoin()- Expand arrayslength()- Get array lengthtoDate()- Date conversionrow_number() OVER (PARTITION BY ... ORDER BY ...)- Window functions
Testing
Recent Updates
- Enhanced Migration System: Full Laravel migration integration with custom commands
- Cluster Support: Multi-node ClickHouse cluster with load balancing and health checks
- Exception Handling: Comprehensive error handling with custom exception types
- CLI Interface: Interactive ClickHouse client and management commands
- Performance Optimization: Configurable performance settings and connection pooling
- Documentation: Complete documentation with examples and best practices
Credits
This package was originally created by bavix and has been significantly enhanced with modern Laravel features, cluster support, and comprehensive testing.
License
MIT License
All versions of laravel-clickhouse with dependencies
illuminate/support Version ^5.6|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
illuminate/database Version ^5.6|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
illuminate/console Version ^5.6|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
smi2/phpclickhouse Version ^1.4