{"id":15715755,"url":"https://github.com/renoki-co/l1","last_synced_at":"2025-04-09T14:10:26.769Z","repository":{"id":197712439,"uuid":"651202208","full_name":"renoki-co/l1","owner":"renoki-co","description":"Extend your PHP/Laravel application with Cloudflare bindings.","archived":false,"fork":false,"pushed_at":"2024-05-02T09:48:38.000Z","size":47,"stargazers_count":106,"open_issues_count":11,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-06-30T13:24:54.395Z","etag":null,"topics":["ai","cloudflare","cloudflare-workers","d1","database","kv","laravel","php","queues","vectorize","workers"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/renoki-co.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"rennokki"}},"created_at":"2023-06-08T18:20:54.000Z","updated_at":"2024-06-13T01:12:28.000Z","dependencies_parsed_at":"2024-10-03T21:42:49.966Z","dependency_job_id":"e56ef885-469a-440b-9698-2f581ef9d137","html_url":"https://github.com/renoki-co/l1","commit_stats":null,"previous_names":["renoki-co/l1"],"tags_count":1,"template":false,"template_full_name":"renoki-co/laravel-package-skeleton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renoki-co%2Fl1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renoki-co%2Fl1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renoki-co%2Fl1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renoki-co%2Fl1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renoki-co","download_url":"https://codeload.github.com/renoki-co/l1/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054195,"owners_count":21039952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","cloudflare","cloudflare-workers","d1","database","kv","laravel","php","queues","vectorize","workers"],"created_at":"2024-10-03T21:42:46.491Z","updated_at":"2025-04-09T14:10:26.746Z","avatar_url":"https://github.com/renoki-co.png","language":"PHP","funding_links":["https://github.com/sponsors/rennokki"],"categories":[],"sub_categories":[],"readme":"# L1 - Cloudflare bindings for Laravel\n\n![CI](https://github.com/renoki-co/l1/workflows/CI/badge.svg?branch=master)\n[![codecov](https://codecov.io/gh/renoki-co/l1/branch/master/graph/badge.svg)](https://codecov.io/gh/renoki-co/l1/branch/master)\n[![StyleCI](https://github.styleci.io/repos/651202208/shield?branch=master)](https://github.styleci.io/repos/651202208)\n[![Latest Stable Version](https://poser.pugx.org/renoki-co/l1/v/stable)](https://packagist.org/packages/renoki-co/l1)\n[![Total Downloads](https://poser.pugx.org/renoki-co/l1/downloads)](https://packagist.org/packages/renoki-co/l1)\n[![Monthly Downloads](https://poser.pugx.org/renoki-co/l1/d/monthly)](https://packagist.org/packages/renoki-co/l1)\n[![License](https://poser.pugx.org/renoki-co/l1/license)](https://packagist.org/packages/renoki-co/l1)\n\nExtend your PHP/Laravel application with Cloudflare bindings.\n\nThis package offers support for:\n\n- [x] [Cloudflare D1](https://developers.cloudflare.com/d1)\n- [ ] [Cloudflare KV](https://developers.cloudflare.com/kv/)\n- [ ] [Cloudflare Queues](https://developers.cloudflare.com/queues)\n\n## 🚀 Installation\n\nYou can install the package via Composer:\n\n```bash\ncomposer require renoki-co/l1\n```\n\n## 🙌 Usage\n\n### D1 with raw PDO\n\nThough 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.\n\n```php\nuse RenokiCo\\L1\\D1\\D1Pdo;\nuse RenokiCo\\L1\\D1\\D1PdoStatement;\nuse RenokiCo\\L1\\CloudflareD1Connector;\n\n$pdo = new D1Pdo(\n    dsn: 'sqlite::memory:', // irrelevant\n    connector: new CloudflareD1Connector(\n        database: 'your_database_id',\n        token: 'your_api_token',\n        accountId: 'your_cf_account_id',\n    ),\n);\n```\n\n### D1 with Laravel\n\nIn your `config/database.php` file, add a new connection:\n\n```php\n'connections' =\u003e [\n    'd1' =\u003e [\n        'driver' =\u003e 'd1',\n        'prefix' =\u003e '',\n        'database' =\u003e env('CLOUDFLARE_D1_DATABASE_ID', ''),\n        'api' =\u003e 'https://api.cloudflare.com/client/v4',\n        'auth' =\u003e [\n            'token' =\u003e env('CLOUDFLARE_TOKEN', ''),\n            'account_id' =\u003e env('CLOUDFLARE_ACCOUNT_ID', ''),\n        ],\n    ],\n]\n```\n\nThen in your `.env` file, set up your Cloudflare credentials:\n\n```\nCLOUDFLARE_TOKEN=\nCLOUDFLARE_ACCOUNT_ID=\nCLOUDFLARE_D1_DATABASE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n```\n\nThe `d1` driver will proxy the PDO queries to the Cloudflare D1 API to run queries.\n\n## 🐛 Testing\n\nStart the built-in Worker that simulates the Cloudflare API:\n\n```bash\ncd tests/worker\nnpm ci\nnpm run start\n```\n\nIn a separate terminal, run the tests:\n\n``` bash\nvendor/bin/phpunit\n```\n\n## 🤝 Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## 🔒  Security\n\nIf you discover any security related issues, please email \u003calex@renoki.org\u003e instead of using the issue tracker.\n\n## 🎉 Credits\n\n- [Alex Renoki](https://github.com/rennokki)\n- [All Contributors](../../contributors)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenoki-co%2Fl1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenoki-co%2Fl1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenoki-co%2Fl1/lists"}