PHP code example of ziming / laravel-cloudflare-workers-kv
1. Go to this page and download the library: Download ziming/laravel-cloudflare-workers-kv library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ziming / laravel-cloudflare-workers-kv example snippets
return [
'account_id' => env('CLOUDFLARE_KV_ACCOUNT_ID'),
'namespace_id' => env('CLOUDFLARE_KV_NAMESPACE_ID'),
'api_token' => env('CLOUDFLARE_KV_API_TOKEN'),
'base_url' => env('CLOUDFLARE_KV_BASE_URL', 'https://api.cloudflare.com/client/v4'),
// HTTP timeouts (seconds) so a hung connection never blocks the request.
'timeout' => env('CLOUDFLARE_KV_TIMEOUT', 5),
'connect_timeout' => env('CLOUDFLARE_KV_CONNECT_TIMEOUT', 2),
// When true, read failures (KV outage) degrade to a cache miss instead of
// throwing. See "Graceful reads" below.
'graceful' => env('CLOUDFLARE_KV_GRACEFUL', false),
'serializer' => env('CLOUDFLARE_KV_SERIALIZER', 'php'),
// Restricts which classes may be instantiated when unserializing PHP-serialized
// values. Use an array of class-strings to allowlist, false to forbid all objects,
// or null (default) to allow all. See "Security" below.
'allowed_classes' => null,
'prefix' => env('CLOUDFLARE_KV_PREFIX', ''),
];