PHPackages                             stefna/config - 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. stefna/config

ActiveLibrary

stefna/config
=============

Lightweight config loader with type safety

1.4.0(12mo ago)07.3k↓44.6%1MITPHPPHP ^8.2CI passing

Since Feb 8Pushed 12mo ago3 watchersCompare

[ Source](https://github.com/stefna/php-config-loader)[ Packagist](https://packagist.org/packages/stefna/config)[ RSS](/packages/stefna-config/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (10)Versions (10)Used By (1)

Config
======

[](#config)

[![Build Status](https://github.com/stefna/php-config-loader/actions/workflows/continuous-integration.yml/badge.svg?branch=main)](https://github.com/stefna/php-config-loader/actions/workflows/continuous-integration.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/cfa986577921170edab91a5b52e236ee195b49e03e8fe1c7a6c5aa0a660d5443/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737465666e612f636f6e6669672e737667)](https://packagist.org/packages/stefna/config)[![Software License](https://camo.githubusercontent.com/c49cabc4f5e5642ded1b7f16c182fd3c64e952bd2234c815f834c1ca481941eb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f737465666e612f7068702d636f6e6669672d6c6f616465722e737667)](LICENSE)

This package is a lightweight config loader with type safety as the primary corner stone.

Requirements
------------

[](#requirements)

PHP 8.2 or higher.

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

[](#installation)

```
composer require stefna/config
```

Motivation
----------

[](#motivation)

Most config loaders fail to give the user a way to use it in a type safe way.

It also promises to be immutable after first read.

Usage
-----

[](#usage)

### Load config from file

[](#load-config-from-file)

We support writing your config in php files

Example:

```
