Skip to content

Commit 6a57309

Browse files
committed
remove simple example
1 parent 294219c commit 6a57309

File tree

2 files changed

+11
-32
lines changed

2 files changed

+11
-32
lines changed

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,21 @@ In your PHP project, just add these lines to verify an IP:
4343

4444
```php
4545

46-
/* To get a bouncer api key: "cscli bouncers add <name-of-your-php-bouncer> */
47-
$bouncerApiKey = 'YOUR_BOUNCER_API_KEY';
46+
<?php
47+
use CrowdSecBouncer\Bouncer;
4848

49-
/* Select the best cache adapter for your needs (Memcached, Redis, PhpFiles, ...) */
50-
$cacheAdapter = new Symfony\Component\Cache\Adapter\PhpFilesAdapter();
49+
// Init bouncer
50+
$bouncer = new Bouncer();
51+
$bouncer->configure(['api_key' => 'YOUR_BOUNCER_API_KEY', 'api_url' => 'http://127.0.0.1:8080']);
5152

52-
$bouncer = new CrowdSecBouncer\Bouncer($cacheAdapter);
53-
$bouncer->configure(['api_key'=> $bouncerApiKey]);
54-
55-
$remediation = $bouncer->getRemediationForIp($blockedIp);// Return "ban", "captcha" or "bypass"
53+
// Ask remediation to API
54+
$remediation = $bouncer->getRemediationForIp($requestedIp);
55+
echo "\nResult: $remediation\n\n"; // "ban", "captcha" or "bypass"
5656
```
5757

58-
View [`docs/complete-guide.md`](https://github.com/crowdsecurity/php-cs-bouncer/blob/main/docs/complete-guide.md) to learn how to include this library in your project in minutes.
58+
View [`examples/live-mode/full-example-live-mode.php`](examples/live-mode/full-example-live-mode.php).
59+
60+
> You can also follow the [`docs/complete-guide.md`](docs/complete-guide.md) to learn how to include this library in your project in minutes.
5961
6062
## Future
6163
- Retrieve decisions stored in cache using pagination

examples/live-mode/simple-example-live-mode.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)