---
application: "Intervention Validation"
version: "Version 4"
status: "stable"
---

# ISBN Rule

## Validate International Standard Book Number

Learn how to validate International Standard Book Numbers (ISBN) with the additional validation rules of Intervention Validation for your Laravel application.

> public Intervention\Validation\Rules\Isbn::__construct(array $lengths = [10, 13])

The field under validation must be a valid [International Standard Book Number](https://en.wikipedia.org/wiki/International_Standard_Book_Number) (ISBN).

### Parameters

#### lengths (optional)

Optional array of allowed lengths to check only for ISBN-10 or ISBN-13.

### Example

```php
use Illuminate\Support\Facades\Validator;
use Intervention\Validation\Rules\Isbn;

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

```php
use Illuminate\Support\Facades\Validator;
use Intervention\Validation\Rules\Isbn;

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

---

## 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)