Download the PHP package sinemacula/data-normalizer-php without Composer

On this page you can find all versions of the php package sinemacula/data-normalizer-php. 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 data-normalizer-php

Data Normalizer for PHP

Latest Stable Version Build Status Quality Gates Maintainability Code Coverage Total Downloads

Consistent, deterministic normalization for the common data types every system handles slightly differently — names, emails, phone numbers, postal addresses, dates, currencies, and more. Each data type is encapsulated in a small, single-purpose normalizer behind one static facade, so Normalizer::phone($value) returns the same canonical output everywhere it is called.

The library is framework-agnostic — it has no dependency on Laravel or any other framework — and extensible: any consuming application can register its own normalizers without forking the package.

How It Works

Every normalizer implements a single contract, NormalizerInterface, and is reached through the Normalizer facade. Calls are routed by name: Normalizer::email($value) resolves to the Email normalizer, dispatches to its normalize() method, and returns the result. Resolution is memoised, so the lookup cost is paid once per name per process.

A few rules hold across the surface:

Supported Normalizers

Normalizer Call Result
clean Normalizer::clean($value) Collapses internal whitespace and trims the ends; the building block for the other normalizers
name Normalizer::name($value) Title-cases personal names; preserves Mc / Mac / O' prefixes, lowercases particles (van, de, von), and flips Doe, John to John Doe
email Normalizer::email($value) Lowercases and strips spaces
phone Normalizer::phone($value, ?$country) Formats to E.164 via libphonenumber; defaults to the US region, returns null for invalid numbers
date Normalizer::date($value) Parses a set of known formats to Y-m-d; returns null for invalid calendar dates
timezone Normalizer::timezone($value) Resolves to a canonical IANA timezone identifier (case-insensitive)
addressLine Normalizer::addressLine($value) Title-cases the line and strips trailing commas
postalCode Normalizer::postalCode($value, ?$country) Validates and formats to the country's canonical form (UK/Canada spacing, US ZIP+4 hyphen); without a country, uppercases and trims
country Normalizer::country($value) Resolves a country name or code to its ISO 3166-1 alpha-2 code, with fuzzy matching for near-misses
administrativeArea Normalizer::administrativeArea($value, ?$country) Resolves a state / province / region name or code to its subdivision code (defaults to the US country)
companyName Normalizer::companyName($value) Normalizes legal suffixes (Inc, LLC, Ltd, GmbH, SARL)
jobTitle Normalizer::jobTitle($value) Title-cases titles while preserving acronyms (CEO, IT, R&D) and lowercasing stop words
currency Normalizer::currency($value) Validates and uppercases to an ISO 4217 currency code
ssn Normalizer::ssn($value) Strips to digits; preserves already-redacted values such as ***123

Installation

Usage

Extending

Register your own normalizers at application bootstrap. A custom normalizer is any class implementing SineMacula\Foundation\Normalizers\Contracts\NormalizerInterface:

Registration is validated eagerly — register() throws an InvalidNormalizerException (an InvalidArgumentException subclass) immediately if the class does not implement NormalizerInterface, so misconfiguration surfaces at bootstrap rather than at call time. Registering the same name twice overwrites the earlier registration (last write wins).

[!WARNING] Registered normalizers take precedence over the built-ins. Registering a name such as phone or clean intentionally replaces the built-in behaviour for every caller in the process — a deliberate feature, but one that can cause hard-to-trace differences in normalized output if used accidentally.

Register at bootstrap only. In long-running runtimes (Octane, Swoole, RoadRunner, queue workers) the registry is shared process state — treat it as write-once during boot and read-only thereafter. Normalizer::flush() clears all registrations and is intended for test isolation only.

For IDE completion of your custom normalizers, subclass the facade (it is intentionally non-final) purely to carry @method docblocks:

Requirements

Testing

Changelog

See CHANGELOG.md for a list of notable changes.

Contributing

Contributions are welcome. Please read CONTRIBUTING.md for guidelines on branching, commits, code quality, and pull requests.

Security

If you discover a security vulnerability, please report it responsibly. See SECURITY.md for the disclosure policy and contact details.

License

Licensed under the Apache License, Version 2.0.


All versions of data-normalizer-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
brick/postcode Version ^0.6
commerceguys/addressing Version ^2.2
giggsey/libphonenumber-for-php Version ^9.0
symfony/intl Version ^7.4|^8.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 sinemacula/data-normalizer-php contains the following files

Loading the files please wait ...