The Cloudflare API for Laravel 10
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
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.
zoneId
listZones
addRecord
listRecords
getRecordDetails
updateRecordDetails
deleteRecord
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
If you have any questions feel free to ask in the issues tab on github. Same with adding more direct queries or other methods.