Skip to content

Commit

Permalink
README
Browse files Browse the repository at this point in the history
  • Loading branch information
svilborg committed Jul 18, 2019
1 parent 1b01667 commit 67f78db
Showing 1 changed file with 31 additions and 32 deletions.
63 changes: 31 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,38 +54,6 @@ Add the api route
Route::get('/health', 'Health\Controllers\HealthController@check');
```

### Custom Health Check

```php
use Health\Checks\BaseCheck;
use Health\Checks\HealthCheckInterface;

class ServiceACheck extends BaseCheck implements HealthCheckInterface
{

/**
*
* {@inheritdoc}
* @see \Health\Checks\HealthCheckInterface::call()
*/
public function call()
{
$health = $this->getBuilder('Service A');

if(!$this->serviceA->connect()) {
$health->withData('error', 'Service A Failed')
->down();
}
else {
$health->up();
}

return $health->build();
}
}
```


### Example Response Payload

```json
Expand Down Expand Up @@ -138,4 +106,35 @@ Add the api route
]
}

```

### Custom Health Check

```php
use Health\Checks\BaseCheck;
use Health\Checks\HealthCheckInterface;

class ServiceACheck extends BaseCheck implements HealthCheckInterface
{

/**
*
* {@inheritdoc}
* @see \Health\Checks\HealthCheckInterface::call()
*/
public function call()
{
$health = $this->getBuilder('Service A');

if(!$this->serviceA->connect()) {
$health->withData('error', 'Service A Failed')
->down();
}
else {
$health->up();
}

return $health->build();
}
}
```

0 comments on commit 67f78db

Please sign in to comment.