Download the PHP package glushkovds/phpclickhouse-laravel without Composer

On this page you can find all versions of the php package glushkovds/phpclickhouse-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpclickhouse-laravel

Tests

phpClickHouse-laravel

Laravel and Lumen adapter for popular ClickHouse libraries:

Features

Requires only the PHP cURL extension. PHP 8.0 or higher is supported.

See phpClickHouse features for more details: https://github.com/smi2/phpClickHouse#features

Prerequisites

Installation

Install via Composer:

Laravel will discover the package service provider automatically.

The package registers a clickhouse database connection with sensible defaults. Set only the environment values you need to override:

If your application uses cached configuration, rebuild the cache after changing ClickHouse environment values.

The package registers this connection as database.connections.clickhouse automatically when the application does not already define it in config/database.php.
If you need to override the defaults or add advanced options, define the connection in config/database.php:

If you use Lumen or have disabled Laravel package discovery, register the service provider manually:

Usage

You can use smi2/phpClickHouse functionality directly:

See the phpClickHouse documentation for more details: https://github.com/smi2/phpClickHouse/blob/master/README.md

Lightweight Eloquent-like model layer

1. Add a model

2. Add a migration

You can also use the Schema Builder:

3. Insert data

Single row

Bulk insert

4. Query data

Known issues

Known issues are described in docs/known_issues.md.

Advanced usage

Column casting

Before insertion, columns are converted to the data types defined in $casts.
This feature does not apply to data selection.
Supported cast types: boolean.

Events

Events work like Eloquent model events.
Available events: creating, created, saved.

Retries

You may enable request retries for non-200 responses, for example when temporary network issues occur.

Add the value to your .env file:

CLICKHOUSE_RETRIES is optional. The default value is 0.
0 means one attempt.
1 means one attempt plus one retry on error, for a total of two attempts.

Working with huge rows

You can chunk results like in Laravel:

Buffer engine for insert queries

See https://clickhouse.tech/docs/en/engines/table-engines/special/buffer/

If you also want to read from the buffer table, set $table to the buffer table name:

OPTIMIZE Statement

See https://clickhouse.com/docs/ru/sql-reference/statements/optimize/

TRUNCATE Statement

Removes all data from a table.

Deletions

See https://clickhouse.com/docs/en/sql-reference/statements/alter/delete/

When using the Buffer engine, OPTIMIZE and ALTER TABLE DELETE can target the source table:

Updates

See https://clickhouse.com/docs/ru/sql-reference/statements/alter/update/

Helpers for inserting different data types

Working with multiple ClickHouse instances in a project

1. Add a second connection to config/database.php:

2. Add a model

3. Add a migration

Cluster mode

Important!

Your config/database.php should look like this:

Migration example:

You can get the current node host and switch the active connection to the next node:


All versions of phpclickhouse-laravel with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
smi2/phpclickhouse Version ^1.4.2
glushkovds/clickhouse-builder Version ^7
illuminate/support Version >=7
illuminate/database Version >=7
glushkovds/php-clickhouse-schema-builder Version ^1.0.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package glushkovds/phpclickhouse-laravel contains the following files

Loading the files please wait ...