Edited README
This commit is contained in:
5
.gitignore
vendored
Normal file → Executable file
5
.gitignore
vendored
Normal file → Executable file
@@ -1,2 +1,3 @@
|
|||||||
/.idea
|
/.idea
|
||||||
/vendor/
|
/vendor/
|
||||||
|
/nbproject/
|
||||||
|
|||||||
79
README.md
Normal file → Executable file
79
README.md
Normal file → Executable file
@@ -2,49 +2,48 @@
|
|||||||
|
|
||||||
[](https://travis-ci.org/cloudflare/cloudflare-php)
|
[](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,
|
||||||
echo $user->getUserID();
|
string $content,
|
||||||
|
int $ttl = 0,
|
||||||
|
bool $proxied = true,
|
||||||
|
string $priority = '',
|
||||||
|
array $data = []
|
||||||
|
): \stdClass {
|
||||||
|
$options = [
|
||||||
|
'type' => $type,
|
||||||
|
'name' => $name,
|
||||||
|
'content' => $content,
|
||||||
|
'proxied' => $proxied
|
||||||
|
];
|
||||||
|
|
||||||
|
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.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user