Skip to content

v1.1.0

Choose a tag to compare

@RobertWesner RobertWesner released this 11 Oct 21:58
· 13 commits to main since this release
2579e61

Full Changelog: v1.0.0...v1.1.0

New

Superglobals

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

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

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

// ...

Autoloading with novarity enforcement

By default Novara itself will autoload with enforcement.
Your own project can easily set up an autoloader thanks to the \Novara\Base\Autoloader\Loader class.

Spreading

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.