PHPackages                             neutrino/dotconst - 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. neutrino/dotconst

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

neutrino/dotconst
=================

The Neutrino dotconst package.

v1.0.0(8y ago)014MITPHPPHP &gt;=5.6.1

Since May 24Pushed 8y ago1 watchersCompare

[ Source](https://github.com/pn-neutrino/dotconst)[ Packagist](https://packagist.org/packages/neutrino/dotconst)[ Docs](https://phalcon-nucleon.github.io)[ RSS](/packages/neutrino-dotconst/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (4)Dependencies (2)Versions (7)Used By (0)

Neutrino : Dotconst component
=============================

[](#neutrino--dotconst-component)

[![Build Status](https://camo.githubusercontent.com/c45e8764343367bb64113887e95ef78ef1175b57531e08aa955f9ba463a91c96/68747470733a2f2f7472617669732d63692e6f72672f706e2d6e65757472696e6f2f646f74636f6e73742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/pn-neutrino/dotconst) [![Coverage Status](https://camo.githubusercontent.com/77de1902e1775fb1b2ce2f9a4b6ed1e9d9071b142175c294f3b4d2b2ffdcf2d1/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f706e2d6e65757472696e6f2f646f74636f6e73742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/pn-neutrino/dotconst)

Loads constants variables from `.const.ini`, `.const.[APP_ENV].ini` files.

How Use
=======

[](#how-use)

Make sure the `.const.ini`, `.const.*.ini`, file is added to your .gitignore so it is not checked-in the code.

Add this to your .gitignore :

```
.const.ini
.const.*.ini

```

Create your `.const.ini` and put any variables in !

Dotconst work with .ini file.

Every sections will be flatten. Each variable will be prefixed with the section name.

Every variable will be UPPERIZED. e.g.

```
[database]
user = db_user

```

Will become

```
DATABASE_USER === 'db_user'
```

Special key
-----------

[](#special-key)

```
base_path = @php/dir
app_env = @php/env:APP_ENV
php_v = @php/const:PHP_VERSION_ID

```

Will become :

```
BASE_PATH === {base path of .const.ini file}
APP_ENV === getenv('APP_ENV')
PHP_V === PHP_VERSION_ID
```

And compile :

```
define('BASE_PATH', '{base path of .const.ini file}');
define('APP_ENV', getenv('APP_ENV'));
define('PHP_V', PHP_VERSION_ID);
```

Loading
-------

[](#loading)

It's really simple, just add this to your bootstrap :

```
\Neutrino\Dotconst::load('/ini_path' [, '/compile_path']);
```

Environment Overloading
-----------------------

[](#environment-overloading)

The first file called is ".const.ini". If the variable "APP\_ENV" is defined in this file, dotconst will look for the file ".const. {APP\_ENV} .ini", and override the base values. Useful when working on multiple environments.

```
; .const.ini
[app]
env = production

[database]
host = localhost

```

```
; .const.production.ini
[database]
host = 10.0.0.0

```

Will become

```
DATABASE_HOST === '10.0.0.0'
```

Compilation
-----------

[](#compilation)

For the best performance, you can compile the variables loaded into a php file, by calling :

```
\Neutrino\Dotconst\Compile::compile('/ini_path', '/compile_path');
```

Will generate for this ini file :

```
; .const.ini
[database]
user = db_user

```

```
define('DATABASE_USER', 'db_user');
```

Extensions
----------

[](#extensions)

I can easily extends Dotconst :

```
class MyExtention extends \Neutrino\Dotconst\Extensions\Extension{

    protected $identifier = "php/my";

    public function parse($value, $path) {
        return 'my';
    }

    public function compile($value, $path){
        return "'my'";
    }
}

\Neutrino\Dotconst::addExtension(MyExtention::class);
```

In your .const.ini file :

```
[foo]
bar = @php/my
```

Will be parse :

```
FOO_BAR === 'my'
```

And compile :

```
define('FOO_BAR', 'my');
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Recently: every ~63 days

Total

6

Last Release

3070d ago

Major Versions

0.2.0 → 1.0.x-dev2018-02-02

### Community

Maintainers

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

---

Top Contributors

[![Ark4ne](https://avatars.githubusercontent.com/u/6144058?v=4)](https://github.com/Ark4ne "Ark4ne (9 commits)")

---

Tags

environmentconstnucleonneutrinodotconst

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/neutrino-dotconst/health.svg)

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

###  Alternatives

[vlucas/phpdotenv

Loads environment variables from `.env` to `getenv()`, `$\_ENV` and `$\_SERVER` automagically.

13.5k627.3M6.1k](/packages/vlucas-phpdotenv)[symfony/dotenv

Registers environment variables from a .env file

3.8k237.6M2.6k](/packages/symfony-dotenv)[foroco/php-browser-detection

Ultra fast PHP library to detect browser, OS, platform and device type by User-Agent parsing

1515.3M7](/packages/foroco-php-browser-detection)[wolfcast/browser-detection

The Wolfcast BrowserDetection PHP class facilitates the identification of the user's environment such as Web browser, version, platform family, platform version or if it's a mobile device or not.

1391.1M7](/packages/wolfcast-browser-detection)[imliam/laravel-env-set-command

Set a .env file variable from the command line

118357.6k10](/packages/imliam-laravel-env-set-command)[silverstripe/environmentcheck

Provides an API for building environment tests

33511.9k14](/packages/silverstripe-environmentcheck)

PHPackages © 2026

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