PHPackages                             parallel-oss/l1 - 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. parallel-oss/l1

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

parallel-oss/l1
===============

Laravel integration for Cloudflare Workers services.

1.0.9(2mo ago)093↓50%Apache-2.0PHPPHP ^8.2

Since Feb 16Pushed 2mo agoCompare

[ Source](https://github.com/parallel-oss/l1)[ Packagist](https://packagist.org/packages/parallel-oss/l1)[ Docs](https://github.com/parallel-oss/l1)[ RSS](/packages/parallel-oss-l1/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (11)Used By (0)

L1 - Cloudflare bindings for Laravel
====================================

[](#l1---cloudflare-bindings-for-laravel)

[![CI](https://github.com/parallel-oss/l1/workflows/CI/badge.svg?branch=master)](https://github.com/parallel-oss/l1/workflows/CI/badge.svg?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/99caeb9bc82e026ce23410644353f5368c6f4798a273c117842f48bcb2210d81/68747470733a2f2f706f7365722e707567782e6f72672f706172616c6c656c2d6f73732f6c312f762f737461626c65)](https://packagist.org/packages/parallel-oss/l1)[![License](https://camo.githubusercontent.com/5914bf0c2c11d6079420ebeccca5712de8f4be4badb7dbbfa010fbfea8bfbf55/68747470733a2f2f706f7365722e707567782e6f72672f706172616c6c656c2d6f73732f6c312f6c6963656e7365)](https://packagist.org/packages/parallel-oss/l1)

Extend your PHP/Laravel application with Cloudflare bindings.

This package offers support for:

- [Cloudflare D1](https://developers.cloudflare.com/d1)
- [Cloudflare KV](https://developers.cloudflare.com/kv/)
- [Cloudflare Queues](https://developers.cloudflare.com/queues)

🚀 Installation
--------------

[](#-installation)

You can install the package via Composer:

```
composer require parallel-oss/l1
```

🙌 Usage
-------

[](#-usage)

### D1 with raw PDO

[](#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

[](#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

[](#d1-compatibility-notes)

This package keeps D1 usage close to native Laravel/SQLite, while accounting for Cloudflare-specific runtime limits:

- Multi-row `INSERT` queries 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](docs/d1-sqlite-compatibility.md) for the full behavior matrix.

🐛 Testing
---------

[](#-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
--------------

[](#-contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

🔒 Security
----------

[](#-security)

If you discover any security related issues, please open an issue on GitHub.

🎉 Credits
---------

[](#-credits)

- [Alex Renoki](https://github.com/rennokki) – original author
- [Parallel](https://github.com/parallel-oss) – maintainer
- [All Contributors](../../contributors)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance84

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.2% 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.

###  Release Activity

Cadence

Every ~1 days

Total

10

Last Release

82d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ffa4cdf0b83948b1b33a89b67d6ff2e8295b86e2855b94e34acac878224c946?d=identicon)[parallel-oss](/maintainers/parallel-oss)

---

Top Contributors

[![emaadali](https://avatars.githubusercontent.com/u/3521616?v=4)](https://github.com/emaadali "emaadali (12 commits)")[![rennokki](https://avatars.githubusercontent.com/u/21983456?v=4)](https://github.com/rennokki "rennokki (6 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

phplaraveldatabasesqlitequerycloudflareserverlesskvworkersr2d1serverless functionsserverless frameworkserverless architecture

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/parallel-oss-l1/health.svg)

```
[![Health](https://phpackages.com/badges/parallel-oss-l1/health.svg)](https://phpackages.com/packages/parallel-oss-l1)
```

###  Alternatives

[renoki-co/l1

Laravel integration for Cloudflare Workers services.

16113.1k](/packages/renoki-co-l1)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[ntanduy/cloudflare-d1-database

Easy configuration and setup for D1 Database connections in Laravel.

215.4k](/packages/ntanduy-cloudflare-d1-database)[bvanhoekelen/performance

PHP performance tool analyser your script on time, memory usage and db query. Support Laravel and Composer for web, web console and command line interfaces.

521774.3k4](/packages/bvanhoekelen-performance)[spiritix/lada-cache

A Redis based, automated and scalable database caching layer for Laravel

591444.8k2](/packages/spiritix-lada-cache)

PHPackages © 2026

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