Download the PHP package makinacorpus/normalization without Composer

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

Normalization helpers

PHP class name to business domain name naming strategies and normalization helpers.

Main feature is the name map, which provide a reversible and predictible class name to business name and a business name to class name conversion whose goal is to be put in front of any component that exposes PHP class name to the outside world, in order to be able to alias your internal type names to business domain names.

Tagging

Each name conversion entry is associated to an arbitrary tag which purpose is to deambiguate logical names among contextes, for example consider your have those two classes:

You then have a name conflict. In order to solve this it is possible to tag each class the following way:

When converting from aliased name to PHP class name, you may specify the expected tag in the current context, and thus avoid those ambiguities.

While querying for a PHP name class using a logical name:

A PHP class may be used for more than one logical name, so the following will apply while querying for a logical name using a PHP class name:

Both resolution algorithms to and from a PHP class name behave the same.

Static naming strategies

Using attributes

You may simply give a default name to one class.

Or target some context using tags:

Or if you wish, give more than one name in different contextes:

You also can provide as many aliases in the same tag or under the default tag as you wish, for example when you rename business items and wish to keep a backward compatibility:

You can also simply give a priority (result will be same as using the deprecated argument) but without raising any deprecation notices on the PHP side:

The previously explained algorithm will work using all those parameters.

Using Symfony configuration

@todo

Dynamic naming stategies

This provides three different class naming strategies:

You can configure the name map to hold an infinite number of strategies, each one identified by a tag, which permits to each service using this API to have its own naming strategy.

The name map allows user-defined aliases map, which can hold a infinite number of name aliases for a single PHP class name, allowing your project to be resilient to past conventions. One use case for this is, for example, when you change your naming convention while being plugged over a message bus: your application may continue to consume older messages while being upgraded.

Additionnaly, it provides a few other helpers:

Setup

Install this package:

If you are using Symfony, add the bundle in your config/bundles.php:

Or you can do a standalone setup of the name map:

Symfony bundle configuration

Here is an example config/packages/normalization.yaml file:

Usage

In order to use the name map, simply inject the service into the service needing it:

If you are working in a Symfony application, you may simply use the MakinaCorpus\Normalization\NameMap\NameMapAware interface on the object in order for it to be automatically populated by the container:

Testing

A docker environement with various containers for various PHP versions is present in the sys/ folder. For tests to work in all PHP versions, you need to run composer update --prefer-lowest otherwise PHP 7.4 tests will fail.


All versions of normalization with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
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 makinacorpus/normalization contains the following files

Loading the files please wait ....