Download the PHP package axlon/laravel-postal-code-validation without Composer

On this page you can find all versions of the php package axlon/laravel-postal-code-validation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-postal-code-validation

Laravel Postal Code Validation

Worldwide postal code validation for Laravel, based on Google's Address Data Service.

Build status Downloads Latest version License

Requirements

This package has the following requirements:

Laravel / Lumen version Package version
5.1 - 5.4 2.x
5.5 and greater 3.x

Installation

You can install this package with Composer, by running the command below:

If you have package discovery enabled, that's it, continue to the usage section. If you want to register the package manually, you can do this by adding the following line to your config/app.php file:

Lumen

If you are using Lumen, register the package by adding the following line to your bootstrap/app.php file:

Usage

Postal code validation perfectly integrates into your Laravel application, you can use it just like you would any framework validation rule.

Available rules

This package adds the following validation rules:

postal_code:foo,bar,...

The field under validation must be a valid postal code in at least one of the given countries. Arguments must be countries in ISO 3166-1 alpha-2 format.

postal_code_with:foo,bar,...

The field under validation must be a postal code in at least one of the countries in the given fields only if at least one of the specified fields is present.

Fluent API

If you prefer using a fluent object style over string based rules, that's also available:

The same goes for the postal_code_with rule:

Adding an error message

To add a meaningful error message, add the following lines to resources/lang/{your language}/validation.php:

The following placeholders will be automatically filled for you:

Placeholder Description
:attribute The name of the field that was under validation
:countries The countries that were validated against (e.g. NL, BE)*
:examples Examples of allowed postal codes (e.g. 1234 AB, 4000)*

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

Manually validating

If you want to validate postal codes manually outside of Laravel's validation system, you can call the validator directly, like so:

Overriding rules

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

Important: If you believe there is a bug in one of the patterns that this package ships with, please create an issue in the issue tracker.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

This open-source software is licenced under the MIT license. This software contains code generated from Google's Address Data Service, more information on this service can be found here.


All versions of laravel-postal-code-validation with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^8.0
illuminate/contracts Version ^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
illuminate/support Version ^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
illuminate/validation Version ^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package axlon/laravel-postal-code-validation contains the following files

Loading the files please wait ....