PHPackages                             sirix/sirix-env - 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. sirix/sirix-env

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

sirix/sirix-env
===============

A helper function to retrieve environment variables with type casting

1.0.0(4mo ago)064MITPHPPHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Jan 4Pushed 4mo agoCompare

[ Source](https://github.com/sirix777/sirix-env)[ Packagist](https://packagist.org/packages/sirix/sirix-env)[ Docs](https://github.com/sirix777)[ Fund](https://buymeacoffee.com/sirix)[ GitHub Sponsors](https://github.com/sirix777)[ RSS](/packages/sirix-sirix-env/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Sirix Env
=========

[](#sirix-env)

A helper function to retrieve environment variables with type casting.

---

Installation
------------

[](#installation)

Install this tool using [composer](https://getcomposer.org/).

```
composer require sirix/sirix-env

```

Usage
-----

[](#usage)

This library provides a global `env` function that allows you to retrieve environment variables and automatically cast them to their appropriate PHP types.

### Basic Usage

[](#basic-usage)

```
use function Sirix\Env\env;

$value = env('MY_VAR');
$defaultValue = env('NON_EXISTENT', 'default');
```

### Type Casting

[](#type-casting)

The `env` function automatically casts string values to the following types:

ValuePHP TypeResult`'true'`, `'(true)'`boolean`true``'false'`, `'(false)'`boolean`false``'null'`, `'(null)'`null`null``'empty'`, `'(empty)'`string`''``'123'`, `'1.23'`integer / float`123` / `1.23`Other valuesstringOriginal string (trimmed)### Static usage

[](#static-usage)

If you prefer not to use the global function, you can use the `EnvParser` class directly:

```
use Sirix\Env\EnvParser;

$value = EnvParser::parse('true'); // true
```

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance82

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

125d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6ecccf9003c061847e877eeea3bdf1b382f6f9dbb11d33112d6b2740bf0533f9?d=identicon)[sirix777](/maintainers/sirix777)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sirix-sirix-env/health.svg)

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

PHPackages © 2026

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