giginc/cakephp5-driver-bigquery
Composer 安装命令:
composer require giginc/cakephp5-driver-bigquery
包简介
BigQuery direver for CakePHP 5.x
README 文档
README
An BigQuery for CakePHP 5.x
Installing via composer
Install composer and run:
composer require giginc/cakephp5-driver-bigquery
Defining a connection
Now, you need to set the connection in your config/app.php file:
'Datasources' => [ ... 'bigquery' => [ 'className' => 'Giginc\BigQuery\Database\Connection', 'driver' => 'Giginc\BigQuery\Database\Driver\BigQuery', 'projectId' => env('BIGQUERY_PROJECT_ID', 'project_id'), 'dataSet' => env('BIGQUERY_DATASET', 'dataset'), 'keyFile' => [], // Console. Ex: json_decode(file_get_contents($path), true). 'keyFilePath' => null, //The full path to your service account credentials .json file retrieved. 'requestTimeout' => 0, // Defaults to 0 with REST and 60 with gRPC. 'retries' => 3, // Number of retries for a failed request. Defaults to 3. 'location' => 'us', // If provided, determines the default geographic location used when creating datasets and managing jobs. 'maximumBytesBilled' => 1000000, ], ],
Models
After that, you need to load Giginc\BigQuery\ORM\Table in your tables class:
Table
//src/Model/Table/ProductsTable.php namespace App\Model\Table; use Giginc\BigQuery\ORM\Table; /** * ProductsTable Table * * @uses Table * @package Table */ class ProductsTable extends Table { public function initialize(array $config): void { parent::initialize($config); $this->setTable('products_%Y%m%d'); $this->setSchema([ [ "name" => "name", "type" => "STRING", "mode" => "NULLABLE", ],[ "name" => "description", "type" => "STRING", "mode" => "NULLABLE", ],[ "name" => "count", "type" => "INTEGER", "mode" => "NULLABLE", ],[ "name" => "created_at", "type" => "DATETIME", "mode" => "NULLABLE", ], ]); } public static function defaultConnectionName(): string { return 'bigquery'; } public function findOk($query, array $options) { $query = $query ->where([ 'status' => 'ok', ]); return $query; } }
Entity
//src/Model/Entity/Product.php namespace App\Model\Entity; use Cake\ORM\Entity; /** * Product Entity * * @uses Entity * @package Entity */ class Product extends Entity { protected $_accessible = [ '*' => true, 'id' => false, ]; protected $_virtual = [ ]; } ## Controllers ```php namespace App\Controller; use App\Controller\AppController; /** * Pages Controller * * @property \App\Model\Table\PagesTable $Pages * * @method \App\Model\Entity\Review[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = []) */ class PagesController extends AppController { /** * Index method * * @access public * @return \Cake\Http\Response|void */ public function index() { // select $data = $this->fetchTable('Products')->date('2021-04-12') ->bqFind() ->fields([ 'name', 'description', 'MAX(count) AS max', 'COUNT(*) AS count', ]) ->where([ 'name' => 'iphone', 'count >' => 0, ]) ->group(['name', 'description']) ->order(['name' => 'DESC']) ->limit(5) ->all(); // insert $this->fetchTable('Products')->insert([ 'name' => 'iPhoneXR', 'description' => 'iPhoneXR', 'created_at' => '2021-04-21', ]); } }
LICENSE
giginc/cakephp5-driver-bigquery 适用场景与选型建议
giginc/cakephp5-driver-bigquery 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 81 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「orm」 「plugin」 「cakephp」 「driver」 「datasource」 「bigquery」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 giginc/cakephp5-driver-bigquery 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 giginc/cakephp5-driver-bigquery 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 giginc/cakephp5-driver-bigquery 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
Kinikit - PHP Application development framework MVC component
PHP Database ORM for Symfony1. Do NOT use for new projects: please move to a newest Symfony release and Doctrine2
Email Toolkit Plugin for CakePHP
PeskyORM - annoying ORM that contains tons of exceptions and throws them when anything goes wrong
Rhino, a CMS and Application-Framework plugin for CakePHP
统计信息
- 总下载量: 81
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 50
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-21