<commit_before># rest-client

A simple REST client with PHPs cURL.

## Usage

Define your options

```php
$options = [
    'url' => 'http://api.localhost/v1',
];
```

See `\Chriha\Clients\Rest::getDefaultOptions()` for all default options.

### GET

```php
$rest = new \Chriha\Clients\Rest( $options );
$rest->get( '/posts' );
```

### POST

```php
$post = [
    "title" => "lorem",
    "body"  => "lorem ipsum dolor set"
];

$rest = new \Chriha\Clients\Rest( $options );
$rest->post( '/posts', $post );
```

### PUT / PATCH

```php
$post = [
    "title" => "lorem"
];

$rest = new \Chriha\Clients\Rest( $options );
$rest->put( '/posts/1', $post );
```

### DELETE

```php
$rest = new \Chriha\Clients\Rest( $options );
$rest->delete( '/posts/1' );
```

## Options

### Allow self signed certificates

Recommended only in dev environment. Default: `false`

```php
$options = [
    'allow_self_signed' => true,
];
```

### Set additional cURL options

```php
$options = [
    'curl_options' => [...],
];
```<commit_msg>change formatting<commit_after># rest-client

A simple REST client with PHPs cURL.

## Usage

Define your options

```php
$options = [
    'url' => 'http://api.localhost/v1',
];
```

See `\Chriha\Clients\Rest::getDefaultOptions()` for all default options.

#### GET

```php
$rest = new \Chriha\Clients\Rest( $options );
$rest->get( '/posts' );
```

#### POST

```php
$post = [
    "title" => "lorem",
    "body"  => "lorem ipsum dolor set"
];

$rest = new \Chriha\Clients\Rest( $options );
$rest->post( '/posts', $post );
```

#### PUT / PATCH

```php
$post = [
    "title" => "lorem"
];

$rest = new \Chriha\Clients\Rest( $options );
$rest->put( '/posts/1', $post );
```

#### DELETE

```php
$rest = new \Chriha\Clients\Rest( $options );
$rest->delete( '/posts/1' );
```

## Options

#### Allow self signed certificates

Recommended only in dev environment, so default is `false`

```php
$options = [
    'allow_self_signed' => true,
];
```

#### Set additional cURL options

```php
$options = [
    'curl_options' => [...],
];
```
{'fraction_non_alphanumeric': 0.23084431429965838, 'fraction_numerical': 0.0029282576866764276, 'mean_word_length': 3.5454545454545454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 2, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4564243', 'n_tokens_mistral': 812, 'n_tokens_neox': 770, 'n_words': 187}