joshuapack/laravel-cloudflare

Use the Cloudflare API for Laravel 10 / 11 and PHP >= 8.1.

v0.3.2 2023-12-26 19:00 UTC

This package is auto-updated.

Last update: 2024-04-12 18:58:09 UTC


README

The Cloudflare API for Laravel 10

See documentation

How to Install

First do composer require joshuapack/laravel-cloudflare

Get the following information.

  1. Your Cloudflare email, simple, the one you use to log in with.
  2. Your Cloudflare API Key, found in your account settings.
  3. 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.

  1. CLOUDFLARE_EMAIL
  2. CLOUDFLARE_API_KEY
  3. 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.