PHPackages                             axy/envnorm - 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. axy/envnorm

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

axy/envnorm
===========

Initial normalization of the environment

0.1.5(9y ago)1701MITPHPPHP &gt;=5.4.0

Since Jan 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/axypro/envnorm)[ Packagist](https://packagist.org/packages/axy/envnorm)[ Docs](https://github.com/axypro/envnorm)[ RSS](/packages/axy-envnorm/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

axy\\envnorm
============

[](#axyenvnorm)

Initial normalization of the environment

[![Latest Stable Version](https://camo.githubusercontent.com/ae046630743e7f8ea652ddff85331168bd2e02914b08d2dd65762df341d42bdd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6178792f656e766e6f726d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/axy/envnorm)[![Minimum PHP Version](https://camo.githubusercontent.com/b52c83f3d45755ebcb1e6863ebb202ab192aaf773424369ffdeedae107f027ef/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230352e342d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)[![Build Status](https://camo.githubusercontent.com/eaf639437af1686c9e32ff06a7a0b2526131792f3fcafe687fc9b3bac652d46f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f61787970726f2f656e766e6f726d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/axypro/envnorm)[![Coverage Status](https://camo.githubusercontent.com/569f1da1159bf07167242a96d8b3b8ad38e8dc5f6cdd9022d88a486a8bebd23d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f61787970726f2f656e766e6f726d2f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/axypro/envnorm?branch=master)[![License](https://camo.githubusercontent.com/9c23959a8dc74f9100add0586946a46b55ee4274af20eeca046ded972096b9bc/68747470733a2f2f706f7365722e707567782e6f72672f6178792f656e766e6f726d2f6c6963656e7365)](LICENSE)

- The library does not require any dependencies (except composer packages).
- Tested on PHP 5.4+, PHP 7, HHVM (on Linux), PHP 5.5 (on Windows).
- Install: `composer require axy/envnorm`.
- License: [MIT](LICENSE).

### Documentation

[](#documentation)

#### How to use

[](#how-to-use)

```
use axy\envnorm\Normalizer;

$normalizer = new Normalizer();
$normalizer->normalize();
```

Or (do not litter in the global scope):

```
Normalizer::createInstance()->normalize();
```

Or (custom configuration):

```
$config = [
    'datetime' => null,
    'encoding' => 'Windows-1251',
];

Normalizer::createInstance($config)->normalize();
```

The library is intended for rearrangement of the PHP-environment before the application start.

#### The configuration

[](#the-configuration)

The default configuration is this

```
[
    'errors' => [
        'level' => E_ALL,
        'display' => null,
        'handler' => true,
        'ErrorException' => 'ErrorException',
        'exceptionHandler' => null,
        'allowSuppression' => true,
    ],
    'datetime' => [
        'timezone' => 'UTC',
        'keepTimezone' => true,
    ],
    'encoding' => 'UTF-8',
    'options' => [],
];
```

You can override the parameters that you need. A custom configuration merges with the default by `array_replace_recursive()`.

`NULL` in a value means that action should not be performed.

```
$custom = [
    'errors' => [
        'handler' => null, // do not use a custom error handler
    ],
    'datetime' => null, // do not perform any action on the date and time settings
];
```

#### Errors

[](#errors)

Default means the following behavior:

- All errors (including warnings, notices and etc) lead to the stop (by an exception).
- Show or hide the error depends on the platform (development or production).

The following describes the fields of the configuration section `errors`.

##### `level (int)`

[](#level-int)

[The bitmask](http://php.net/manual/en/errorfunc.constants.php) of handled error types. By default is `E_ALL`.

##### `display (boolean)`

[](#display-boolean)

The value for the `display_errors` option. By default is `NULL`: a script shouldn't set `display_errors`, it must be set in php.ini (depends on the platform).

##### `handler (callback)`

[](#handler-callback)

The callback for the error handler (see [set\_error\_handler()](http://php.net/manual/en/function.set-error-handler.php)). IF `NULL` then do not set a custom handler. IF `TRUE` then set the handler from the library.

The library handler throws an exception (`ErrorException` or its child) for each error.

```
$a = [];
$a['a'] = $a['b']; // ErrorException
```

##### `ErrorException (string)`

[](#errorexception-string)

The library `handler` uses this option. This is the class name of the exception. It is `ErrorException` by default and can be a child of `ErrorException`.

##### `allowSuppression (bool)`

[](#allowsuppression-bool)

This option allows suppression of error by @-operator.

```
$a = [];
$a['a'] = @$a['b'];
```

The default (`allowSuppression=TRUE`) it do not lead to the exception. If set this option to `FALSE` the exception will be thrown regardless of `@`.

##### `exceptionHandler (callback)`

[](#exceptionhandler-callback)

The top level handler for exceptions. See [set\_exception\_handler()](http://php.net/manual/en/function.set-exception-handler.php).

The default is `NULL`: the handler will not set.

#### Timezone

[](#timezone)

##### `datetime.timezone (string)`

[](#datetimetimezone-string)

The default timezone. `UTC` by default.

##### `datetime.keepTimezone (bool)`

[](#datetimekeeptimezone-bool)

The default (`keepTimezone=TRUE`) remains the timezone from php.ini. `datetime.timezone` only used if the timezone is not defined in php.ini.

#### Encoding

[](#encoding)

The `encoding` option used in `mbstring` (if it is installed).

#### Options

[](#options)

All other PHP-options that should be changed.

```
$config = [
    'options' => [
        'sendmail_from' => 'me@server.loc',
        'mysqli.default_port' => 3307,
    ],
];
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~105 days

Recently: every ~132 days

Total

6

Last Release

3615d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e5b3a2db8d5614167d4510019e3373dbba63c6aade58d38d23f3e7d2e63c3c4a?d=identicon)[axy](/maintainers/axy)

---

Top Contributors

[![vasa-c](https://avatars.githubusercontent.com/u/557081?v=4)](https://github.com/vasa-c "vasa-c (27 commits)")

---

Tags

error-reportingerror-handlertimezone

### Embed Badge

![Health badge](/badges/axy-envnorm/health.svg)

```
[![Health](https://phpackages.com/badges/axy-envnorm/health.svg)](https://phpackages.com/packages/axy-envnorm)
```

###  Alternatives

[brick/date-time

Date and time library

3623.3M61](/packages/brick-date-time)[jamesmills/laravel-timezone

Timezone storage and retrieval for Laravel

698764.1k12](/packages/jamesmills-laravel-timezone)[camroncade/timezone

Helps manage timezones in Laravel. Includes &lt;select&gt; form builder for timezones.

162982.4k7](/packages/camroncade-timezone)[dater/dater

Compact PHP library for working with date/time in different formats &amp; timezones.

14282.3k](/packages/dater-dater)[icanboogie/datetime

Extends the features of PHP DateTime and DateTimeZone

51345.7k3](/packages/icanboogie-datetime)[tapp/filament-timezone-field

Filament timezone field.

55276.6k4](/packages/tapp-filament-timezone-field)

PHPackages © 2026

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