Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sdk Laravel Package

cloudflare/sdk

A Laravel SDK for the Cloudflare API, making it easy to manage zones, DNS records, caches, and other Cloudflare resources straight from your PHP application with a clean, expressive, framework-friendly interface.

View on GitHub
Deep Wiki
Context7

PHP library for the Cloudflare v4 API

Frequently asked questions about Sdk
How do I install cloudflare/sdk in a Laravel application?
Install it with Composer using composer require cloudflare/sdk. You need PHP 8.1 or newer and a compatible Guzzle 7/PSR-7 stack; the package does not ship a Laravel service provider, facade, or config file. Create a small service class or container binding that constructs the client with your API token.
Does cloudflare/sdk work with Laravel 10 and Laravel 11?
Yes, because cloudflare/sdk is framework-agnostic and does not depend on a specific Laravel version. It will work on Laravel releases running PHP 8.1 or newer with compatible PSR-7 and Guzzle dependencies. Laravel 8 and 9 can also run on PHP 8.1, but applications still on PHP 7.4 or 8.0 must upgrade PHP before adopting the SDK.
How do I configure Cloudflare API token authentication in Laravel?
Store a scoped Cloudflare API token in your .env file or config services entry, then inject it into the SDK client through a container binding. The token is the main security boundary, so grant only the zone and cache permissions your automation needs. Avoid committing tokens and rotate them if they are exposed.
What Cloudflare features can I manage with cloudflare/sdk?
The SDK covers common operational resources such as zones, DNS records, cache purging, firewall rules, page rules, analytics, and account resources. It tracks a curated subset of the Cloudflare API v4 rather than every endpoint. Newer products like Workers, R2, Zero Trust, Turnstile, or new WAF rulesets may lag or be unavailable.
Can I purge Cloudflare cache by URL or cache tag with PHP?
Yes. The cache endpoint supports purging by URL, by cache tag, and purging everything through the Cloudflare API v4. In Laravel, wrap the purge call in a service class and pass the zone ID and tags or URLs from configuration or your deployment process. Check the API response and log failures because the SDK does not convert Cloudflare errors into typed exceptions.
How do I manage DNS records and zones from Laravel using cloudflare/sdk?
Instantiate the client with your API token, then use the zone and DNS endpoint classes to list zones and create, update, or delete DNS records. Keep this logic in a bounded-context service rather than injecting Cloudflare endpoint objects directly into controllers. That makes testing, token scoping, and error handling easier to manage.
What PHP version does cloudflare/sdk 2.0 require?
cloudflare/sdk 2.0 requires PHP 8.1 or newer, which is a hard Composer gate for older applications. The maintainers test PHP 8.1 through 8.4, and 2.0.0 fixes PHP 8.4 implicit-nullable deprecations. If your Laravel app is still on PHP 7.4 or 8.0, plan a runtime upgrade before adopting or upgrading to 2.0.
Is cloudflare/sdk safe to use for production DNS automation and cache purging?
It is suitable for narrow operational tasks such as DNS automation, deploy-time cache purges, and zone provisioning, provided you use a scoped API token. The token can mutate production DNS and purge caches, so treat it as a privileged secret and limit its permissions. Also implement your own error branching, retries, and logging because the SDK exposes Cloudflare's HTTP status and error-body semantics rather than typed exceptions.
How do I test Laravel code that uses cloudflare/sdk?
Put the SDK behind your own service interface and mock or fake that interface in Laravel tests, so your application tests do not call the live Cloudflare API. For lower-level tests, inject a fake PSR-18 HTTP client or use Guzzle mock handlers to assert requests and simulate API responses. Cover error branches explicitly because the SDK does not provide typed exceptions for Cloudflare failures.
What are the alternatives to cloudflare/sdk for Laravel projects?
Alternatives include calling the Cloudflare API v4 directly with Guzzle or Laravel's HTTP client, or using community Laravel wrappers that add facades and config publishing. cloudflare/sdk itself is a thin, framework-agnostic client with no service provider or facade, and its ecosystem of known-good Laravel wrappers is small. Choose based on endpoint coverage, PHP 8.1 compatibility, and whether you want to own the integration layer.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo