<commit_before># Writing Dredd Hooks In PHP

[![Build Status](https://travis-ci.org/ddelnano/dredd-hooks-php.svg?branch=master)](https://travis-ci.org/ddelnano/dredd-hooks-php)

[GitHub repository](https://github.com/ddelnano/dredd-hooks-php)

PHP hooks are using [Dredd's hooks handler socket interface](hooks-new-language.md). For using PHP hooks in Dredd you have to have [Dredd already installed](quickstart.md)

## Installation

```
$ composer require ddelnano/dredd-hooks-php:~1.0.0 --dev 
```

## Usage

```
$ dredd apiary.apib http://localhost:3000 --language vendor/bin/dredd-hooks-php --hookfiles=./hooks*.php
```

## API Reference

The `Dredd\Hooks` class provides the static methods listed below to create hooks 

1. `beforeEach`, `beforeEachValidation`, `afterEach`<commit_msg>Add supported php versions to the php hook docs<commit_after># Writing Dredd Hooks In PHP

[![Build Status](https://travis-ci.org/ddelnano/dredd-hooks-php.svg?branch=master)](https://travis-ci.org/ddelnano/dredd-hooks-php)

[GitHub repository](https://github.com/ddelnano/dredd-hooks-php)

PHP hooks are using [Dredd's hooks handler socket interface](hooks-new-language.md). For using PHP hooks in Dredd you have to have [Dredd already installed](quickstart.md)

## Installation

### Requirements
 - php version >= 5.4

Installing dredd-hooks-php can be easily installed through the package manager, composer.

```
$ composer require ddelnano/dredd-hooks-php:~1.0.0 --dev 
```

## Usage

```
$ dredd apiary.apib http://localhost:3000 --language vendor/bin/dredd-hooks-php --hookfiles=./hooks*.php
```

## API Reference

The `Dredd\Hooks` class provides the static methods listed below to create hooks 

1. `beforeEach`, `beforeEachValidation`, `afterEach`
{'fraction_non_alphanumeric': 0.14269340974212033, 'fraction_numerical': 0.010315186246418338, 'mean_word_length': 4.762376237623762, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1255939', 'n_tokens_mistral': 612, 'n_tokens_neox': 600, 'n_words': 146}