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

# Postal Code Rule

## Validate Postal Codes for Individual Countries



> public Intervention\Validation\Rules\Postalcode::__construct(string $countrycode)

The field under validation must be a [postal code](https://en.wikipedia.org/wiki/Postal_code) of the given country.

### Parameters

#### countrycode

Country code string in [ISO-639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.

### Example

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

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

---

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