parallel-oss/l1
Composer 安装命令:
composer require parallel-oss/l1
包简介
Laravel integration for Cloudflare Workers services.
关键字:
README 文档
README
Extend your PHP/Laravel application with Cloudflare bindings.
This package offers support for:
🚀 Installation
You can install the package via Composer:
composer require parallel-oss/l1
L1 supports Laravel 12 and 13. Laravel 13 requires PHP 8.3 or newer, matching Laravel's own runtime requirement.
🙌 Usage
D1 with raw PDO
Though D1 is not connectable via SQL protocols, it can be used as a PDO driver via the package connector. This proxies the query and bindings to the D1's /query endpoint in the Cloudflare API.
use Parallel\L1\D1\D1Pdo; use Parallel\L1\D1\D1PdoStatement; use Parallel\L1\CloudflareD1Connector; $pdo = new D1Pdo( dsn: 'sqlite::memory:', // irrelevant connector: new CloudflareD1Connector( database: 'your_database_id', token: 'your_api_token', accountId: 'your_cf_account_id', ), );
D1 with Laravel
In your config/database.php file, add a new connection:
'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', ''), ], ], ]
Then in your .env file, set up your Cloudflare credentials:
CLOUDFLARE_TOKEN=
CLOUDFLARE_ACCOUNT_ID=
CLOUDFLARE_D1_DATABASE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
The d1 driver will proxy the PDO queries to the Cloudflare D1 API to run queries.
D1 compatibility notes
This package keeps D1 usage close to native Laravel/SQLite, while accounting for Cloudflare-specific runtime limits:
- Multi-row
INSERTqueries are automatically chunked to D1's bind-parameter limit. - Statements above D1 limits that cannot be safely rewritten fail fast with explicit errors.
- Transport and API error responses are normalized into stable PDO/Laravel exceptions.
- Retry behavior is conservative by default (safe/read-only and explicitly idempotent-safe paths).
These constraints still require app-level design choices:
- D1 SQL/statement limits (for example statement size, row/blob size, function argument limits).
- Workload shaping for long-running writes/migrations (batching and index strategy).
- Transaction expectations that differ from local SQLite when execution is remote/request-scoped.
See docs/d1-sqlite-compatibility.md for the full behavior matrix.
🐛 Testing
Run all tests (the built-in D1 worker is started automatically):
composer test
This starts the Worker that simulates the Cloudflare D1 API, runs PHPUnit, then stops the worker. The first run will install worker dependencies (npm ci in tests/worker) if needed.
🤝 Contributing
Please see CONTRIBUTING for details.
🔒 Security
If you discover any security related issues, please open an issue on GitHub.
🎉 Credits
- Alex Renoki – original author
- Parallel – maintainer
- All Contributors
parallel-oss/l1 适用场景与选型建议
parallel-oss/l1 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 118 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「php」 「sqlite」 「query」 「laravel」 「cloudflare」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 parallel-oss/l1 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 parallel-oss/l1 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 parallel-oss/l1 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
Store your language lines in the database, yaml or other sources
The tenancy/tenancy database driver for sqlite
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Slimmed down concise interfaces and query builder for database queries and transactions which can be layered / decorated.
A PSR-7 compatible library for making CRUD API endpoints
统计信息
- 总下载量: 118
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2026-02-16