PHPackages                             new-inventor/transformers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. new-inventor/transformers

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

new-inventor/transformers
=========================

Property bag with automatic value normalizing and formatting

1.5.1(8y ago)03542MITPHPPHP &gt;=7.0

Since Oct 10Pushed 8y ago1 watchersCompare

[ Source](https://github.com/new-inventor/transformers)[ Packagist](https://packagist.org/packages/new-inventor/transformers)[ RSS](/packages/new-inventor-transformers/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (3)Versions (18)Used By (2)

Data Transformers
=================

[](#data-transformers)

This utility provide to you some transformers for transform your data to another representation.

#### Installation

[](#installation)

composer require new-inventor/transformers

### Simple usage of normalizer

[](#simple-usage-of-normalizer)

```
$transformer = new ToInt();
or
$transformer = ToInt::make();
$res = $transformer->transform($value);
```

**Transformers** transform values from different types to needed type and format

### Signatures of normalizer constructors

[](#signatures-of-normalizer-constructors)

- ArrayToCsvString(string $separator = ',', string $enclosure = '"', string $escape = '\\', bool $encloseAll = false) // transform one dimension array to csv string
- AsEmpty() // transform empty value to null
- BoolToMixed($true = '1', $false = '0') // transform boll to value according to construct parameters
- ChainTransformer(TransformerInterface ...$transformers) // apply transformers for value in same order as in constructor
- CsvStringToArray(string $separator = ',', string $enclosure = '"', string $escape = '\\') transforms csv string to array
- DateTimeToString(string $format = 'd.m.Y H:i:s') // transforms \\DateTime object to string
- InnerTransformer(TransformerInterface ...$transformers)// apply transformers to array of values if pass null then value should return as is, if array length &gt; transformers count then last transformer should be applied to array\[$key\] there $key &gt; transformers count
- StringToCamelCase()//transform string to camel case (for example 'qwe asd\_zxc' transforms to 'qweAsdZxc')
- StringToDateTime(string $format = 'd.m.Y H:i:s')//transform string to \\DateTime object
- StringToLowerCase()// run strtolower() on string
- StringToPhone()//transform string to international phone (fore example '5-123-123-23-23' transforms to '+51231232323')
- StringToScreamingSnakeCase()//transform string to screaming case (for example 'qwe asd\_zxc' transforms to 'QWE\_ASD\_ZXC')
- StringToUpperCase()// run strtoupper() on string
- ToArray()//transform object, implementing \\Iterator or \\ArrayAccess or have toArray method, or scalar to array
- ToBool()//transform variable to boolean
- ToFloat()//transform numeric value to float
- ToInt()//transform numeric value to int
- ToRange()//transform value to range
- ToString()//transform value that can be transformed to string
- Utf8StringToAsciiString()//transform string to ascii string for example '😁' transforms to 'U+1F601'

If you transform value with wrong type then transformer throw \\NewInventor\\TypeChecker\\Exception\\TypeException If transformer can not transform value it throw \\NewInventor\\Transformers\\Exception\\TransformationException

### Links

[](#links)

- To transform complex objects/arrays use
- To implement property bags use

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Recently: every ~30 days

Total

17

Last Release

3006d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2084172da990b68442d9b2af5c9cd30a006522fc74984a586b02066168f89733?d=identicon)[George Ionov](/maintainers/George%20Ionov)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/new-inventor-transformers/health.svg)

```
[![Health](https://phpackages.com/badges/new-inventor-transformers/health.svg)](https://phpackages.com/packages/new-inventor-transformers)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
