定制 milcomp/cloudflare-d1-database 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

milcomp/cloudflare-d1-database

最新稳定版本:v1.1.7

Composer 安装命令:

composer require milcomp/cloudflare-d1-database

包简介

Easy configuration and setup for D1 Database connections in Laravel.

README 文档

README

StyleCI Packagist Dependency Version Latest Stable Version Total Downloads Monthly Downloads License

Integrate Cloudflare bindings into your PHP/Laravel application.

This package offers support for:

🚀 Installation

composer require milcomp/cloudflare-d1-database

👏 Usage

Integrate Cloudflare D1 with Laravel

Add a new connection in your config/database.php file:

'connections' => [
    'd1' => [
        'driver' => 'd1',
        'prefix' => '',
        'database' => env('CLOUDFLARE_D1_DATABASE_ID', ''),
        'api' => 'https://api.cloudflare.com/client/v4',
        'auth' => [
            'token' => env('CLOUDFLARE_TOKEN', ''),
            'account_id' => env('CLOUDFLARE_ACCOUNT_ID', ''),
        ],
    ],
]

Next, configure your Cloudflare credentials in the .env file:

CLOUDFLARE_TOKEN=
CLOUDFLARE_ACCOUNT_ID=
CLOUDFLARE_D1_DATABASE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

The d1 driver will forward PDO queries to the Cloudflare D1 API to execute them.

🌱 Testing

Start the built-in Worker to simulate the Cloudflare API:

cd tests/worker
npm ci
npm run start

In a separate terminal, run the tests:

vendor/bin/phpunit

🤝 Contributing

Please see CONTRIBUTING for details.

统计信息

  • 总下载量: 154
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-16