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

38

—

LowBetter than 85% of packages

Maintenance76

Regular maintenance activity

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

128d 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)
```

###  Alternatives

[rs/laravel-version-control

Foundations for making your app version controlled. Provides migration, blueprint and base models. Will make your app GxP compliant if you exclusively use the VC models and table structure as set out in this package.

1227.5k](/packages/rs-laravel-version-control)[mad-web/laravel-seoable

Easy to map your eloquent fields to seo properties

407.6k](/packages/mad-web-laravel-seoable)[wpsitecare/carelib

A collection of helpful functions to make creating an awesome theme more enjoyable.

164.6k](/packages/wpsitecare-carelib)

PHPackages © 2026

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