Edited README

This commit is contained in:
Tobia Zanarella
2020-06-19 14:30:07 +02:00
parent 66a2c6ebd7
commit 59e8506a45
2 changed files with 42 additions and 42 deletions

1
.gitignore vendored Normal file → Executable file
View File

@@ -1,2 +1,3 @@
/.idea /.idea
/vendor/ /vendor/
/nbproject/

77
README.md Normal file → Executable file
View File

@@ -2,49 +2,48 @@
[![Build Status](https://travis-ci.org/cloudflare/cloudflare-php.svg?branch=master)](https://travis-ci.org/cloudflare/cloudflare-php) [![Build Status](https://travis-ci.org/cloudflare/cloudflare-php.svg?branch=master)](https://travis-ci.org/cloudflare/cloudflare-php)
## Installation See: ([cloudflare/cloudflare-php](https://github.com/cloudflare/cloudflare-php))
The recommended way to install this package is via the Packagist Dependency Manager ([cloudflare/sdk](https://packagist.org/packages/cloudflare/sdk)). You can get specific usage examples on the Cloudflare Knowledge Base under: [Cloudflare PHP API Binding](https://support.cloudflare.com/hc/en-us/articles/115001661191) # Cloudflare SDK: added by Shellrent
## Cloudflare API version 4 - DNS Record is returned on creation:
The Cloudflare API can be found [here](https://api.cloudflare.com/). `Class: Cloudflare\API\Endpoints\DNS`
Each API call is provided via a similarly named function within various classes in the **Cloudflare\API\Endpoints** namespace:
- [x] [DNS Records](https://www.cloudflare.com/dns/)
- [x] Zones
- [x] User Administration (partial)
- [x] [Cloudflare IPs](https://www.cloudflare.com/ips/)
- [x] [Page Rules](https://support.cloudflare.com/hc/en-us/articles/200168306-Is-there-a-tutorial-for-Page-Rules-)
- [x] [Web Application Firewall (WAF)](https://www.cloudflare.com/waf/)
- [ ] Virtual DNS Management
- [x] Custom hostnames
- [x] Manage TLS settings
- [x] Zone Lockdown and User-Agent Block rules
- [ ] Organization Administration
- [x] [Railgun](https://www.cloudflare.com/railgun/) administration
- [ ] [Keyless SSL](https://blog.cloudflare.com/keyless-ssl-the-nitty-gritty-technical-details/)
- [ ] [Origin CA](https://blog.cloudflare.com/universal-ssl-encryption-all-the-way-to-the-origin-for-free/)
- [x] Crypto
- [x] Load Balancers
- [x] Firewall Settings
Note that this repository is currently under development, additional classes and endpoints being actively added.
## Getting Started
```php ```php
$key = new Cloudflare\API\Auth\APIKey('user@example.com', 'apiKey'); public function addRecord(
$adapter = new Cloudflare\API\Adapter\Guzzle($key); string $zoneID,
$user = new Cloudflare\API\Endpoints\User($adapter); string $type,
string $name,
string $content,
int $ttl = 0,
bool $proxied = true,
string $priority = '',
array $data = []
): \stdClass {
$options = [
'type' => $type,
'name' => $name,
'content' => $content,
'proxied' => $proxied
];
echo $user->getUserID(); if ($ttl > 0) {
$options['ttl'] = $ttl;
}
if (!empty($priority)) {
$options['priority'] = (int)$priority;
}
if (!empty($data)) {
$options['data'] = $data;
}
$user = $this->adapter->post('zones/' . $zoneID . '/dns_records', $options);
$this->body = json_decode($user->getBody());
return $this->body->result;
}
``` ```
## Contributions
We welcome community contribution to this repository. [CONTRIBUTING.md](CONTRIBUTING.md) will help you start contributing.
## Licensing
Licensed under the 3-clause BSD license. See the [LICENSE](LICENSE) file for details.