joshuapack / laravel-cloudflare
Use the Cloudflare API for Laravel 10, 11, and 12 using PHP >= 8.1.
Installs: 1 232
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 1
Forks: 5
Open Issues: 0
Requires
- php: >=8.1
- cloudflare/sdk: ^1.3
- illuminate/contracts: ^10|^11|^12
This package is auto-updated.
Last update: 2025-03-27 19:41:52 UTC
README
The Cloudflare API for Laravel 10-12
How to Install
First do composer require joshuapack/laravel-cloudflare
Get the following information.
- Your Cloudflare email, simple, the one you use to log in with.
- Your Cloudflare API Key, found in your account settings.
- The Zone ID for the domain you want to edit, this is on the main page for the domain.
Put them in your .env
as the following, obviously and respectively.
CLOUDFLARE_EMAIL
CLOUDFLARE_API_KEY
CLOUDFLARE_ZONE_ID
How to use
There is a Facade CloudFlare
You can also use $cf = app()->make('laravel-cloudflare')
Then use $cf
to make the calls like $cf->setZoneId('12312312312312312312323')
For example, you could then list the records like so
$cf->listRecords()
Which would return a collection of your records for that zone.
Current Getters/Setters
zoneId
Current Methods
listZones
addRecord
listRecords
getRecordDetails
updateRecordDetails
deleteRecord
Direct Queries
You can see all API calls [https://github.com/cloudflare/cloudflare-php] for direct querying, however, we only have a couple available at this time.
queryDNS
queryFirewall
queryFirewallSettings
queryZones
queryZoneSettings
Query Any Cloudflare Endpoint from SDK
You can now direct all API calls from the SDK [https://github.com/cloudflare/cloudflare-php]. Use the queryCloudflare()
method. See wiki for examples and more details [https://github.com/joshuapack/laravel-cloudflare/wiki/Query-Cloudflare]
Questions
If you have any questions feel free to ask in the issues tab on github. Same with adding more direct queries or other methods.