2017 © Pedro Peláez
 

symfony-bundle cloudflare-bundle

This Bundle implements the Cloudflare API

image

gpenverne/cloudflare-bundle

This Bundle implements the Cloudflare API

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 8 % Grown

The README.md

CloudflareBundle

A Symfony3 bundle for the PHP library for the Cloudflare v4 API `., (*1)

Install

$ composer require gpenverne/cloudflare-bundle

Configuration

You have to generate a "APIToken" from your cloudflare "My Profile" > "API Tokens" page, (*2)

# app/config/packages/cloudflare.yaml
...
cloudflare:
    api_token: your_cloudflare_api_token

Or for older versions of symfony:, (*3)

# app/config/parameters.yml
parameters:
    cloudflare.api_token: some-cloudflare-api_token

Use it

$cloudflareService = $this->container->get('cloudflare.service');
// Or ...
$cloudflareService = $this->container->get(Gpenverne\CloudflareBundle\Services\CloudflareService::class)
// Or inject in your constructors

// Retrieve a Cloudflare SDK endpoint
$userEndpoint = $cloudflareService->get('User');

// Or use built-in shortcut
$userEndpoint = $cloudflareService->user;

// Listing all zones
$zones = $cloudflareService->zones->listZones();

// Adapted example from extracted from https://support.cloudflare.com/hc/en-us/articles/115001661191
$zones = $cloudflareService->zones;
foreach ($zones->listZones()->result as $zone) {
    echo "Cache purge for " . $zone->name . ": ";
    echo $zones->cachePurgeEverything($zone->id) == true ? "successful" : "failed";
    echo PHP_EOL;

}

// Add a domain to a zone
try {
    return $cloudflareService->dns->addRecord(
        $zone->id,
        'CNAME',
        'my-subdomain',
        'my-domain.com'
    );
} catch (\Exception $e) {
    return false;
}

The Versions

18/03 2018

dev-master

9999999-dev

This Bundle implements the Cloudflare API

  Sources   Download

MIT

The Requires

 

The Development Requires

api cloudflare

18/03 2018

2.0.1

2.0.1.0

This Bundle implements the Cloudflare API

  Sources   Download

MIT

The Requires

 

The Development Requires

api cloudflare

18/03 2018

2.0.0

2.0.0.0

This Bundle implements the Cloudflare API

  Sources   Download

MIT

The Requires

 

The Development Requires

api cloudflare

18/03 2018

v1.x-dev

1.9999999.9999999.9999999-dev

This Bundle implements the Cloudflare API

  Sources   Download

MIT

The Requires

 

The Development Requires

api cloudflare

18/03 2018

1.0.5

1.0.5.0

This Bundle implements the Cloudflare API

  Sources   Download

MIT

The Requires

 

The Development Requires

api cloudflare

06/03 2017

1.0.4

1.0.4.0

This Bundle implements the Cloudflare API

  Sources   Download

MIT

The Requires

 

api cloudflare

15/10 2016

1.0.3

1.0.3.0

This Bundle implements the Cloudflare API

  Sources   Download

MIT

The Requires

 

api cloudflare