Search by

smart-dato / non-solo-cap

tschigo

A set of tools to make working with https://www.nonsolocap.it/ easier in Laravel

Package info

github.com/smart-dato/non-solo-cap

pkg:composer/smart-dato/non-solo-cap

Statistics

Installs: 7 490

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.0.8 2026-09-23 07:26 UTC

This package is auto-updated.

Last update: 2026-09-23 14:34:13 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A small Laravel helper that checks whether an Italian postal code (CAP) exists, using NonSoloCap. All data belongs to NonSoloCap, which offers far more than this package uses and has one of the best databases of Italian postal codes.

Requirements

  • PHP 8.2+
  • Laravel 8 – 13

Installation

composer require smart-dato/non-solo-cap

The service provider and the NonSoloCap facade alias are registered automatically.

Usage

use SmartDato\NonSoloCap\Services\NonSoloCap;

NonSoloCap::validZipcode('39021'); // true
NonSoloCap::validZipcode('99999'); // false

NonSoloCap::generateUrl('39021', 'Laces'); // https://www.nonsolocap.it/?k=39021&c=Laces

validZipcode() queries nonsolocap.it and returns false when the site reports no results. It makes a live HTTP request each time and throws a Guzzle exception if the site cannot be reached, so cache the result if you check the same codes often.

generateUrl() only builds a link to the site's search page for a postal code and/or place name; it makes no request.

Testing

composer test

The validation test calls nonsolocap.it, so it needs network access.

Changelog

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

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.