PHPackages                             cratedb/yii - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. cratedb/yii

ActiveLibrary[Database &amp; ORM](/categories/database)

cratedb/yii
===========

crateDB,PDO, Yii Connection

00PHP

Since Mar 21Pushed 6y ago1 watchersCompare

[ Source](https://github.com/bluecat1999/yii-crateDB)[ Packagist](https://packagist.org/packages/cratedb/yii)[ RSS](/packages/cratedb-yii/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (1)Used By (0)

Yii crate(elastic)db Connection class
-------------------------------------

[](#yii-crateelasticdb-connection-class)

\#####描述: 提供crateDB的一个Connection类

creteDB,elastic 的SQL版本，参见[https://crate.io/．](https://crate.io/%EF%BC%8E)

crateDB PDO 来自, downgrade it for adapting to php 5.5．

\#####配置： １ common/config/bootstrap.php 或者 common/config/bootstrap-local.php 中添加:

```
    require_once (dirname(__DIR__) . '/cratedb/yii/autoload.php');

```

or composer require cratedb/yii

2 common/config/main-local.php 增加crateDB如:

```
    ...
    'cratedb' => [
                'class' => 'Crate\yii\CrateConnection',
                'dsn' => 'crate:localhost:4201/b2b',
                'charset' => 'utf8',
            ],
    ...

```

\#####示例：

```
    ...

    $sql = "SELECT sum(goods_amount) as goods_amounts ,date_format('%Y%m%d',max(a.created)) as last_created,b.sales_staff_id  FROM bd_order a inner
     join md_member b on a.member_id=b.member_id group by b.sales_staff_id order by goods_amounts desc LIMIT 1000";
    $result = \Yii::$app->get('cratedb')->query($sql);
    foreach($result as $v){
        ....
    }
    ....

```

\####历史: １.2019-06-04 query完成，原来查询(支持sql99语法的)sql语句基本无需改变；

２.2019-06-23 mysqlToEs 数据迁移,同步完成,目前迁移同步的有bd\_order,md\_member两个表,兼容SQL 99

语法,支持以下数据类型:

```
    ============= ===========
       DB Type 对应 PHP Type
    ============= ===========
    `boolean`__   `boolean`__
    `byte`__
    `short`__     `integer`__
    `integer`__   `integer`__
    `long`__      `integer`__
    `float`__     `float`__
    `double`__    `float`__
    `string`__    `string`__
    `ip`__        `string`__
    `timestamp`__ `integer`__
    `geo_point`__ `array`__
    `geo_shape`__ `object`__
    `object`__    `object`__
    `array`__     `array`__
    ============= ===========

```

故原mysql中的date,time,datetime,timestamp迁移后转为timestamp类型,timestamp类型字段输出时可使用date\_format函数,100%兼容mysql的 date\_format函数 ３.不支持事务及批量增删改操作

###  Health Score

16

—

LowBetter than 4% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5154170?v=4)[Jason.Chen](/maintainers/bluecat1999)[@bluecat1999](https://github.com/bluecat1999)

---

Top Contributors

[![bluecat1999](https://avatars.githubusercontent.com/u/5154170?v=4)](https://github.com/bluecat1999 "bluecat1999 (1 commits)")

### Embed Badge

![Health badge](/badges/cratedb-yii/health.svg)

```
[![Health](https://phpackages.com/badges/cratedb-yii/health.svg)](https://phpackages.com/packages/cratedb-yii)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
