PHPackages                             novara/base - 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. novara/base

ActiveLibrary

novara/base
===========

Why do it right if you can do it like this?

v1.5.3(12mo ago)1382MITPHPPHP &gt;=8.3CI passing

Since Oct 10Pushed 12mo agoCompare

[ Source](https://github.com/Novara-PHP/base)[ Packagist](https://packagist.org/packages/novara/base)[ RSS](/packages/novara-base/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (12)Used By (2)

Novara
=======

[](#novara)

[![](https://github.com/Novara-PHP/base/actions/workflows/tests.yml/badge.svg)](https://github.com/Novara-PHP/base/actions/workflows/tests.yml/badge.svg)[![](https://raw.githubusercontent.com/Novara-PHP/base/image-data/coverage.svg)](https://raw.githubusercontent.com/Novara-PHP/base/image-data/coverage.svg)[![](https://camo.githubusercontent.com/013df5cdbf32d9196a61798962ac095b260199279d3118d14604c6537e209087/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f4e6f766172612d5048502f62617365)](https://camo.githubusercontent.com/013df5cdbf32d9196a61798962ac095b260199279d3118d14604c6537e209087/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f4e6f766172612d5048502f62617365)[![License: MIT](https://camo.githubusercontent.com/2dba5b16b37f81536234ab2bd7bc8263abcab5aaca04165352516a1bb08fd5fb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4e6f766172612d5048502f62617365)](../../raw/main/LICENSE.txt)

Variables? Disgusting!

Say "No!" to variables! Don't introduce state to your code.

> 9/10 Variables can be replaced with functional programming. I say let's ignore the remaining one and just do it!
>
> — Someone Somewhere

This is an exercise in pain tolerance.

Installation
============

[](#installation)

```
composer require novara/base
```

Usage
=====

[](#usage)

Superglobals
------------

[](#superglobals)

Superglobals (including `$GLOBALS`) can be accessed read-only.

```
// $GLOBALS
Novara::Globals::GLOBALS();

// $_GET
Novara::Globals::GET();

// ...
```

include() and require()
-----------------------

[](#include-and-require)

Enforce *novarity¹* by replacing `require` and `include` with the library functions.

```
Novara::Import::require(__DIR__ . '/autoload.php');
```

> ⓘ You can also autoload via the `\Novara\Base\Autoloader\Loader` class. See [composer.json](composer.json) and [autoload.php](autoload.php).

throwIf()
---------

[](#throwif)

Throws an Exception if the condition evaluates to `true`. Returns `false` if no Exception was thrown.

```
Novara::Exception::throwIf(
    UserService::getUserName() !== 'admin',
    new Exception('This can\'t be right!'),
);
```

spread()
--------

[](#spread)

Reuse a value across multiple calls without creating a dedicated variable.

```
// This variable infested block:
$unnecessaryVariable = SomeService::getWhatever(); // Buffer to not call getWhatever() thrice
doAThing($unnecessaryVariable);
doAnotherThing($unnecessaryVariable);
if ($unnecessaryVariable > 100) {
    echo 'Wow!';
}

// becomes utter beauty:
Novara::Call::spread(
    SomeService::getWhatever(),
    doAThing(...),
    doAnotherThing(...),
    fn () => func_get_arg(0) > 100 && print 'Wow!',
);
```

> ⓘ `spread()` will return `true` if **all** calls return a truthy value, otherwise `false`.

pass()
------

[](#pass)

`Novara::Call::pass()` re-scopes a value as parameter of a function call. Passing allows returning the value from the internal call.

```
Novara::Call::pass(
    MyService::calculateSomethingComplex('foo', 123, func_get_arg(0)),
    fn () => someFunction(func_get_arg(0)) ?: anotherFunction(func_get_arg(0)),
)
```

args()
------

[](#args)

The `Novara::Call::args()` function allows you to ensure novarity yet still have named arguments.

```
Novara::Call::args(
    [
        'name',
        'age',
    ],
    func_get_args(),
)->age === ...
```

This can be combined with passing or spreading.

```
// Reuse args through passing
return Novara::Call::pass(
    Novara::Call::args(
        [
            'name',
            'age',
        ],
        func_get_args(),
    ),
    fn () => 'Name: ' . func_get_arg(0)->name . '; Age: ' . func_get_arg(0)->age,
);

// Share the args through spreading
return Novara::Call::spread(
    Novara::Call::args(
        [
            'name',
            'age',
        ],
        func_get_args(),
    ),
    function () {
        ... func_get_arg(0)->name ...
    },
    function () {
        ... func_get_arg(0)->age ...
    },
);
```

replaceKey()
------------

[](#replacekey)

Copy-on-write with changed value by key of passed array.

```
Novara::Map::replaceKey(
    [
        'foo' => 13,
        'bar' => 14,
    ],
    'bar',
    37,
);

// results in
[
    'foo' => 13,
    'bar' => 37,
]
```

appendToKey()
-------------

[](#appendtokey)

Copy-on-write with appended value by key of passed array.

Array must be multidimensional.

```
Novara::Map::appendToKey(
    [
        'foo' => [1234],
        'bar' => [13],
    ],
    'bar',
    [37],
);

// results in
[
    'foo' => [1234],
    'bar' => [13, 37],
]
```

Why do this?
============

[](#why-do-this)

There a many good reasons to use Novara!

- You want functional programming? We **enforce** it!
- Stateless -&gt; Exactly
- XDEBUG is just *too easy* to use? Get rid of breakpoints!
- Your keyboard conveniently broke in a specific way, not letting you use the Dollar (`$`) symbol

Jokes aside
===========

[](#jokes-aside)

I made this to prove I point. I have yet to find that point...

---

¹ "novarity" describes the complete absence of variables inside a PHP-Script.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance50

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

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

Recently: every ~44 days

Total

10

Last Release

364d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7492d5bc5794df95c1e6c5414ac67b831d60c644b9a443fc02307f9d17741eee?d=identicon)[RobertWesner](/maintainers/RobertWesner)

---

Top Contributors

[![RobertWesner](https://avatars.githubusercontent.com/u/155840994?v=4)](https://github.com/RobertWesner "RobertWesner (21 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/novara-base/health.svg)

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

PHPackages © 2026

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