tomaszaruba / cloudflare-api-nette
Implementation of Cloudflare API into Nette framework
v1.0.1
2016-06-30 17:08 UTC
Requires
- php: >=5.4
- jamesryanbell/cloudflare: ^1.6
Requires (Dev)
- codeception/codeception: ^2.2
- nette/nette: ^2.3
This package is not auto-updated.
Last update: 2025-01-18 21:52:33 UTC
README
Implementation of jamesryanbell/cloudflare for Nette framework.
Install
composer require tomaszaruba/cloudflare-api-nette
Register extensions in config.neon
:
extensions: cloudflare: TomasZaruba\Cloudflare\Nette\DI\CloudflareExtension
Configuration
Example config.neon
cloudflare: email: email@email.com # required email - Cloudflare login key: apiKey # required API key - check Cloudflare administration for more information defaultCache: true # optional true/false if true, creates service Cloudflare\Zone\Cache by default identifier: something # optional - other optional configuration available
Example
use TomasZaruba\Cloudflare\Nette\Api; use Cloudflare\Zone\Cache; class ExampleClass { public function __construct(Api $cloudflareApi, Cache $cloudflareCache){ $this->cloudflareApi = $cloudflareApi; $this->cloudflareCache = $cloudflareCache; // cache autoloads if there is defaultCache: true in config.neon } public function exampleCloudflare() { $dns = new Cloudflare\Zone\Dns($this->cloudflareApi); $dns->create('12345678901234567890', 'A', 'name.com', '127.0.0.1', 120); $this->cloudflareCache->purge_files( $this->cloudflareApi->getParameter('identifier'), array($files) ); } }