PHPackages                             noflash/waffer - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. noflash/waffer

AbandonedArchivedLibrary[PSR &amp; Standards](/categories/psr-standards)

noflash/waffer
==============

It holds every bit of your configuration ...and a maple syrup!

v1.0.0(10y ago)226MITPHPPHP &gt;=5.3.0

Since Jul 18Pushed 5y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

PROJECT ARCHIVED
================

[](#project-archived)

Code is left for historical reasons. If you want something good and modern use [Symfony Config](https://symfony.com/doc/current/components/config.html).

---

Waffer
======

[](#waffer)

A tiny, fast and (if you want) powerful configuration library. It was wrote in intetion of usage with long running PHP daemons. It supports JSON &amp; serializations configuration files out-of-box.

FAQ
---

[](#faq)

### Why *Waffer*?

[](#why-waffer)

When I started working on this code I need some sort of a name. Since it was intended to have smaller version along with bigger one (extending it) I came up with "diet" term stolen right from Panic Inc. and it's DietCoda app ;)
Still eating waffers with maple syrup I laughed and created DietWaffer class. This name sticks.

### There's no XML!

[](#theres-no-xml)

Yup, you're right. I fully agree with Linus who's said:

> XML is the worst format ever designed

I never had enough patience to deal with DOM trees, even with SimpleXML library onboard.
If you wish XML to be supported I kindly welcome pull-request for that feature.

### Wait, where's INI?

[](#wait-wheres-ini)

INI format have a lot of limitations, and it's full of hacks. To be honest Waffer had INI support while ago, bud it was removed due to naming limitations.
For further informations see ***Notes*** section in PHP documentation for [parse\_ini\_string()](http://php.net/parse-ini-string).

Usage
-----

[](#usage)

Every library using Waffer is intended to have it it's default configuration. It's much like jQuery plugins - you can provide some extra options which overwrite default configuration. Single instance of Waffer is intended to be [injected](http://en.wikipedia.org/wiki/Dependency_injection) into multiple objects, deep into application.

### Initialization

[](#initialization)

You can choose one of two classes - Waffer and DietWaffer. Second one contains only core configuration black-box, without any export/import capabilities.
Initial configuration array can be specified as constructor parameter.

### (Re)storing data

[](#restoring-data)

Waffer was built to be simple, powerful and flexible tool. It supports many different ways of getting and storing configuration data. Let code below exaplains all of them:

```
$myAwesomeConfiguration = array(
    'version' => 1.1, //This is global configuration option
    'yummyWaffers' => 10,
    'ACME\FooBar' => array( //Configuration for "FooBar" library by ACME
        'version' => M_PI,
        'bakingTemp' => 280,
        'defaultOwner' => 'Mr. Foo'
    )
);

$config = new DietWaffer($myAwesomeConfiguration); //We don't need full Waffer for options below

//Basic usage
echo "Global version: ".$config->storage['version']."\n"; //Fastest but completly non-OO

$config->setVersion(1.2); //Magic setter
echo "New global version: ".$config->getVersion()."\n"; //...with magic getter

$config->yummyWaffers++; //You can also use magic property set
echo "No. of yummy waffers: ".$config->yummyWaffers."\n"; //...and get

//Namespaces
echo "ACME FooBar version: ".$config->storage['ACME\FooBar']['version']."\n";

$config->setVersion(3.1, 'ACME\FooBar'); //Magic setter
echo "New ACME FooBar version: ".$config->getVersion('ACME\FooBar')."\n"; //...with magic getter

//Removing variables
unset($config->yummyWaffers);

//Checking if variable exists
var_dump(
    isset($config->version),
    isset($config->yummyWaffers),
    isset($config->notin)
);

//Let's drive OO teachers crazy ;]
var_dump(
    $config(),
    $config('ACME\FooBar')
);
```

### Importing &amp; exporting

[](#importing--exporting)

Library supports JSON &amp; (un)serialize oob. It also handles loading &amp; saving settings from/to files.
Let's a piece of code explain everything.

```
$config = new Waffer($myAwesomeConfiguration);

echo "JSON: ".$config->toJSON()."\n";
echo "Serialized: ".$config->serialize()."\n";
echo "Save to file ".print_r($config->toFile("example.conf"), true)."\n"; //This will save JSON file, you can pass Waffer::FORMAT_SERIAL to use serialization
//You can use fromFile() the same way
echo "PHP array: \n".$config."\n";
```

### Libraries integration

[](#libraries-integration)

Waffer intrnally stores configuration as large array. By design every library using Waffer should register it's settings under own namespace key as shown below.

```
namespace ACME\FooBar;

class FooBar {
    public static $defaultConfigutation = array(
        "welecome" => "Hello %s!"
        "funFacts" => array(
            "There's disease named Maple syrup urine disease",
            "Defibrillated patient isn't going to jump out of the bed (unless you're in Hollywood)"
        )
    );

    private $config;

    public function __construct(DietWaffer $config) {
        $this->config = $config;
        $this->config->storage[__NAMESPACE__] = array_replace_recursive(self::$defaultConfigutation, (array)@$this->config->storage[__NAMESPACE__]);
    }
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3957d ago

### Community

Maintainers

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

---

Top Contributors

[![kiler129](https://avatars.githubusercontent.com/u/1227834?v=4)](https://github.com/kiler129 "kiler129 (5 commits)")

---

Tags

configurationSettingsconfigPSR-4

### Embed Badge

![Health badge](/badges/noflash-waffer/health.svg)

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

###  Alternatives

[sandrokeil/interop-config

Provides interfaces and a concrete implementation to create instances depending on configuration via factory classes and ensures a valid config structure. It can also be used to auto discover factories and to create configuration files.

58446.7k34](/packages/sandrokeil-interop-config)[dmishh/settings-bundle

Database centric Symfony configuration management. Global and per-user settings supported.

115254.9k1](/packages/dmishh-settings-bundle)[selective/config

Config component, strictly typed

19185.8k3](/packages/selective-config)[thewunder/conphigure

Framework Agnostic Configuration Library

3115.9k](/packages/thewunder-conphigure)

PHPackages © 2026

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