Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34
Extend your PHP/Laravel application with Cloudflare bindings.
License
renoki-co/l1
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Extend your PHP/Laravel application with Cloudflare bindings.
This package offers support for:
You can install the package via Composer:
composer require renoki-co/l1
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.
useRenokiCo\L1\D1\D1Pdo;useRenokiCo\L1\D1\D1PdoStatement;useRenokiCo\L1\CloudflareD1Connector;$pdo =newD1Pdo( dsn:'sqlite::memory:',// irrelevant connector:newCloudflareD1Connector( database:'your_database_id', token:'your_api_token', accountId:'your_cf_account_id', ),);
In yourconfig/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
Thed1
driver will proxy the PDO queries to the Cloudflare D1 API to run queries.
Start the built-in Worker that simulates the Cloudflare API:
cd tests/workernpm cinpm run start
In a separate terminal, run the tests:
vendor/bin/phpunit
Please seeCONTRIBUTING for details.
If you discover any security related issues, please emailalex@renoki.org instead of using the issue tracker.
About
Extend your PHP/Laravel application with Cloudflare bindings.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.