Skip to content

Commit ff99087

Browse files
committed
Version
1 parent d37d84e commit ff99087

File tree

3 files changed

+25
-118
lines changed

3 files changed

+25
-118
lines changed

CHANGELOG.md

Lines changed: 2 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,5 @@
11
# Changelog
22

3-
## [v3.6.0](https://github.com/axlon/laravel-postal-code-validation/tree/v3.6.0) (2024-03-12)
3+
All notable changes to this project will be documented in this file.
44

5-
- Add support for Laravel 11
6-
7-
## [v3.5.0](https://github.com/axlon/laravel-postal-code-validation/tree/v3.5.0) (2024-01-24)
8-
9-
- Update Dutch validation pattern
10-
- Update Bahraini validation pattern
11-
12-
## [v3.4.0](https://github.com/axlon/laravel-postal-code-validation/tree/v3.4.0) (2023-02-15)
13-
- Add support for Laravel 10
14-
15-
## [v3.3.0](https://github.com/axlon/laravel-postal-code-validation/tree/v3.3.0) (2022-02-08)
16-
- Add support for Laravel 9
17-
18-
## [v3.2.1](https://github.com/axlon/laravel-postal-code-validation/tree/v3.2.1) (2020-12-15)
19-
- Update Cambodia validation pattern
20-
21-
## [v3.2.0](https://github.com/axlon/laravel-postal-code-validation/tree/v3.2.0) (2020-11-27)
22-
- Added support for PHP 8
23-
- Fixed validation passing prematurely if `postal_code_for` or `postal_code_with` only referenced fields in an array
24-
25-
## [v3.1.3](https://github.com/axlon/laravel-postal-code-validation/tree/v3.1.3) (2020-11-07)
26-
- Fixed validation getting bypassed on `postal_code_for` and `postal_code_with` when only some referenced fields were present
27-
28-
## [v3.1.2](https://github.com/axlon/laravel-postal-code-validation/tree/v3.1.2) (2020-10-25)
29-
- Fixed postal_code_for rule failing when none of the referenced fields were present
30-
- Deprecated the postal_code_for rule
31-
- Added postal_code_with rule, which is a drop-in replacement for postal_code_for
32-
- Added deprecation warnings for upcoming 4.0 release
33-
34-
## [v3.1.1](https://github.com/axlon/laravel-postal-code-validation/tree/v3.1.1) (2020-09-30)
35-
- Fixed error when validation receives null ([#23](https://github.com/axlon/laravel-postal-code-validation/issues/23))
36-
37-
## [v3.1.0](https://github.com/axlon/laravel-postal-code-validation/tree/v3.1.0) (2020-09-09)
38-
- Added support for Laravel 8 ([#21](https://github.com/axlon/laravel-postal-code-validation/pull/21))
39-
40-
## [v3.0.0](https://github.com/axlon/laravel-postal-code-validation/tree/v3.0.0) (2020-08-31)
41-
- Dropped support for PHP 7.1 (**breaking change**)
42-
- Dropped support for Laravel 5.1 - 5.4 (**breaking change**)
43-
- Added support for manually overriding validation patterns
44-
- Added exceptions when no arguments are passed to the validation rules (**breaking change**)
45-
- Added PostalCodes facade
46-
- Renamed `Axlon\PostalCodeValidation\Validator` to `Axlon\PostalCodeValidation\PostalCodeValidator` and changed its methods (**breaking change**)
47-
48-
## [v2.1.1](https://github.com/axlon/laravel-postal-code-validation/tree/v2.1.1) (2020-08-16)
49-
- Update Taiwan validation pattern
50-
51-
## [v2.1.0](https://github.com/axlon/laravel-postal-code-validation/tree/v2.1.0) (2020-03-04)
52-
- Added support for Laravel 7
53-
54-
## [v2.0.2](https://github.com/axlon/laravel-postal-code-validation/tree/v2.0.2) (2020-03-03)
55-
- Fixed validation of countries with complex patterns
56-
[#13](https://github.com/axlon/laravel-postal-code-validation/issues/13)
57-
- Fixed rules not being loaded if the validator was resolved before the service provider was called
58-
- Fixed format generator (dev-only)
59-
60-
## [v2.0.1](https://github.com/axlon/laravel-postal-code-validation/tree/v2.0.1) (2019-09-07)
61-
- Added support for Laravel 6
62-
63-
## [v2.0.0](https://github.com/axlon/laravel-postal-code-validation/tree/v2.0.0) (2019-07-06)
64-
- Updated `postal_code` rule, which longer accepts references to request parameters as arguments (**breaking change**)
65-
- Updated fluent API methods (**breaking change**)
66-
- Removed `:formats` error message placeholder (**breaking change**)
67-
- Replaced the validation engine with an internal engine based on Google's Address Data Service
68-
(**potentially breaking change**)
69-
- Added `postal_code_for` rule, which accepts references to request parameters as arguments
70-
- Added `:examples` error message placeholder
71-
- Added support for referencing request parameters inside an array (for example `addresses.*.country`)
72-
- Added support for referencing request variables while using a custom validator class
73-
74-
## [v1.4.1](https://github.com/axlon/laravel-postal-code-validation/tree/v1.4.1) (2019-04-27)
75-
- Fixed replacer being empty if empty input was passed
76-
77-
## [v1.4.0](https://github.com/axlon/laravel-postal-code-validation/tree/v1.4.0) (2019-04-13)
78-
- Added error message replacer for `:countries` and `:formats` placeholders
79-
80-
## [v1.3.1](https://github.com/axlon/laravel-postal-code-validation/tree/v1.3.1) (2019-04-04)
81-
- Lowered PHP requirement from 7.1.3 to 7.1.0
82-
- Removed exception thrown when an invalid country is passed, instead validation now fails
83-
84-
## [v1.3.0](https://github.com/axlon/laravel-postal-code-validation/tree/v1.3.0) (2019-02-27)
85-
- Added Laravel 5.8 support
86-
- Removed Laravel 5.0 support
87-
- Increased minimum required PHP version from 7.0.0 to 7.1.3
88-
89-
## [v1.2.1](https://github.com/axlon/laravel-postal-code-validation/tree/v1.2.1) (2019-02-11)
90-
- Fixed an error when null was passed to the validator
91-
- Added doc blocks
92-
- Added Scrutinizer and StyleCI integration
93-
94-
## [v1.2.0](https://github.com/axlon/laravel-postal-code-validation/tree/v1.2.0) (2018-12-29)
95-
- Other fields in the request can now be used as country code to check against
96-
- Removed useless files from dist
97-
98-
## [v1.1.1](https://github.com/axlon/laravel-postal-code-validation/tree/v1.1.1) (2018-12-27)
99-
- Fixed PHPUnit issues on older versions of Laravel
100-
101-
## [v1.1.0](https://github.com/axlon/laravel-postal-code-validation/tree/v1.1.0) (2018-12-27)
102-
- Country codes are no longer case sensitive
103-
- Documentation improvements
104-
- Minor code improvements
105-
106-
## [v1.0.0](https://github.com/axlon/laravel-postal-code-validation/tree/v1.0.0) (2018-12-07)
107-
- Initial release
5+
## 4.0.0

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Choraimy Kroonstuiver
3+
Copyright (c) 2025 Choraimy Kroonstuiver
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Laravel Postal Code Validation
2+
23
Worldwide postal code validation for Laravel, based on Google's Address Data Service.
34

45
<p align="center">
@@ -31,17 +32,14 @@ Worldwide postal code validation for Laravel, based on Google's Address Data Ser
3132
- [License](#license)
3233

3334
## Requirements
35+
3436
This package has the following requirements:
3537

3638
- PHP 7.2 or higher
3739
- Laravel (or Lumen) 5.5 or higher
3840

39-
| Laravel / Lumen version | Package version |
40-
|-------------------------|-----------------|
41-
| 5.1 - 5.4 | [2.x](https://github.com/axlon/laravel-postal-code-validation/tree/2.x) |
42-
| 5.5 and greater | 3.x |
43-
4441
## Installation
42+
4543
You can install this package with Composer, by running the command below:
4644

4745
```bash
@@ -60,20 +58,24 @@ package manually, you can do this by adding the following line to your `config/a
6058
```
6159

6260
### Lumen
61+
6362
If you are using Lumen, register the package by adding the following line to your `bootstrap/app.php` file:
6463

6564
```php
6665
$app->register(Axlon\PostalCodeValidation\ValidationServiceProvider::class);
6766
```
6867

6968
## Usage
69+
7070
Postal code validation perfectly integrates into your Laravel application, you can use it just like you would any
7171
framework validation rule.
7272

7373
### Available rules
74+
7475
This package adds the following validation rules:
7576

7677
#### postal_code:foo,bar,...
78+
7779
The field under validation must be a valid postal code in at least one of the given countries. Arguments must be
7880
countries in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.
7981

@@ -82,6 +84,7 @@ countries in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha
8284
```
8385

8486
#### postal_code_with:foo,bar,...
87+
8588
The field under validation must be a postal code in at least one of the countries in the given fields _only if_ at least
8689
one of the specified fields is present.
8790

@@ -93,6 +96,7 @@ one of the specified fields is present.
9396
```
9497

9598
### Fluent API
99+
96100
If you prefer using a fluent object style over string based rules, that's also available:
97101

98102
```php
@@ -113,6 +117,7 @@ The same goes for the `postal_code_with` rule:
113117
```
114118

115119
### Adding an error message
120+
116121
To add a meaningful error message, add the following lines to `resources/lang/{your language}/validation.php`:
117122

118123
```php
@@ -122,15 +127,16 @@ To add a meaningful error message, add the following lines to `resources/lang/{y
122127

123128
The following placeholders will be automatically filled for you:
124129

125-
Placeholder | Description
126-
------------|------------
127-
:attribute | The name of the field that was under validation
128-
:countries | The countries that were validated against (e.g. `NL, BE`)*
129-
:examples | Examples of allowed postal codes (e.g. `1234 AB, 4000`)*
130+
| Placeholder | Description |
131+
|-------------|------------------------------------------------------------|
132+
| :attribute | The name of the field that was under validation |
133+
| :countries | The countries that were validated against (e.g. `NL, BE`)* |
134+
| :examples | Examples of allowed postal codes (e.g. `1234 AB, 4000`)* |
130135

131136
*The `:countries` and `:examples` placeholders may be empty if no valid countries are passed.
132137

133138
### Manually validating
139+
134140
If you want to validate postal codes manually outside of Laravel's validation system, you can call the validator
135141
directly, like so:
136142

@@ -139,6 +145,7 @@ PostalCodes::passes($country, $postalCode); // returns a boolean
139145
```
140146

141147
### Overriding rules
148+
142149
Depending on your use case you may want to override the patterns used to validate postal codes for a country. You can do
143150
this by adding the code below in a central place in your application (e.g. a service provider):
144151

@@ -157,16 +164,18 @@ PostalCodes::override([
157164
[issue](https://github.com/axlon/laravel-postal-code-validation/issues/new) in the issue tracker.
158165

159166
## Changelog
167+
160168
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
161169

162170
## Contributing
171+
163172
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
164173

165174
## Credits
175+
166176
- [Choraimy Kroonstuiver](https://github.com/axlon)
167177
- [All contributors](https://github.com/axlon/laravel-postal-code-validation/contributors)
168178

169179
## License
170-
This open-source software is licenced under the [MIT license](LICENSE.md). This software contains code generated from
171-
Google's Address Data Service, more information on this service can be found
172-
[here](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
180+
181+
This open-source software is licenced under the [MIT license](LICENSE.md).

0 commit comments

Comments
 (0)