---
application: "Intervention Validation"
version: "Version 3"
status: "eol"
---

# EAN Rule

## Validate European Article Numbers



> public Intervention\Validation\Rules\Ean::__construct(?int $length = null)

Checks for a valid [European Article Number](https://en.wikipedia.org/wiki/International_Article_Number).

### Parameters

#### length (optional)

Optional integer length (8 or 13) to check only for EAN-8 or EAN-13 or either one if not present.

### Example

```php
use Intervention\Validation\Rules\Ean;

$validator = Validator::make($request->all(), [
    'attribute-key' => new Ean(8),
]);
```

---

## Become a Sponsor

### Intervention Validation needs your help to keep the project going

Intervention Validation is non-commercial, open source licensed and completely free to use. The considerable
effort required to maintain and develop the software is only possible with the financial support
of sponsors. There are two ways in which you can support this project.

- Support via [GitHub Sponsors](https://github.com/sponsors/Intervention)
- Support via [Ko-Fi](https://ko-fi.com/interventionphp)