Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
levidurfee committed Jan 23, 2020
2 parents 0084eab + 1e93f87 commit cff82c1
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,55 @@

[https://wappr.net/api/cf-graph/](https://wappr.net/api/cf-graph/).

## Example

### Account

Using an Account request you can get account level aggregated data.

```php
<?php

use Wappr\Cloudflare\AnalyticsClient;
use Wappr\Cloudflare\Resources\Account;
use Wappr\Cloudflare\DataSets\HttpRequests\HttpRequests1dGroups;
use Wappr\Cloudflare\SelectionSets\HttpRequests\HttpRequestsSum;

require 'vendor/autoload.php';

$dataSet = new HttpRequestsSum();
$request = new HttpRequests1dGroups($dataSet, new DateTime('yesterday'), 10);

// Account IDs you can access.
$accounts = [
'b03c6a7ae48351c6408e00c8159e6e64',
'b03c6a7ae48351c6408e00c8159e6e64',
'b03c6a7ae48351c6408e00c8159e6e64',
'b03c6a7ae48351c6408e00c8159e6e64',
'b03c6a7ae48351c6408e00c8159e6e64',
'b03c6a7ae48351c6408e00c8159e6e64',
];

$threats = 0;

foreach ($accounts as $accountId) {
$client = new AnalyticsClient('accountemail@yourdomain.com', '03288863723b2ad76ef22646c064e93b');
$account = new Account($request, $accountId);
$client->addResource($account);
$response = json_decode($client->runQuery());

dump($response);

$threats = $threats + $response->data->viewer->accounts[0]->httpRequests1dGroups[0]->sum->threats;
}

dump($threats);
```

### Zone

Using an Zone request you can get zone level data.

## Notes

* `vendor/bin/phpunit --coverage-html build`
Expand Down

0 comments on commit cff82c1

Please sign in to comment.