PHP code example of shouyongjiang / phpclickhouse-laravel
1. Go to this page and download the library: Download shouyongjiang/phpclickhouse-laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
shouyongjiang / phpclickhouse-laravel example snippets
namespace App\Models\Clickhouse;
use PhpClickHouseLaravel\BaseModel;
class MyTable extends BaseModel
{
// Not necessary. Can be obtained from class name MyTable => my_table
protected $table = 'my_table';
}
class CreateMyTable extends \PhpClickHouseLaravel\Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
static::write('
CREATE TABLE my_table (
id UInt32,
created_at DateTime,
field_one String,
field_two Int32
)
ENGINE = MergeTree()
ORDER BY (id)
');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
static::write('DROP TABLE my_table');
}
}