Download the PHP package novara/base without Composer
On this page you can find all versions of the php package novara/base. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package base
Short Description Why do it right if you can do it like this?
License MIT
Informations about the package base
Novara
![](https://github.com/Novara-PHP/base/actions/workflows/tests.yml/badge.svg)
![](https://raw.githubusercontent.com/Novara-PHP/base/image-data/coverage.svg)
![](https://img.shields.io/github/v/release/Novara-PHP/base)
[![License: MIT](https://img.shields.io/github/license/Novara-PHP/base)](../../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
Installation
Usage
Superglobals
Superglobals (including $GLOBALS
) can be accessed read-only.
include() and require()
Enforce novarity¹ by replacing require
and include
with the library functions.
ⓘ You can also autoload via the
\Novara\Base\Autoloader\Loader
class. See autoload.php.
throwIf()
Throws an Exception if the condition evaluates to true
.
Returns false
if no Exception was thrown.
spread()
Reuse a value across multiple calls without creating a dedicated variable.
ⓘ
spread()
will returntrue
if all calls return a truthy value, otherwisefalse
.
pass()
Novara::Call::pass()
re-scopes a value as parameter of a function call.
Passing allows returning the value from the internal call.
args()
The Novara::Call::args()
function allows you to ensure novarity yet still have named arguments.
This can be combined with passing or spreading.
Why do this?
There a many good reasons to use Novara!
- You want functional programming? We enforce it!
- Stateless -> 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
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.