Skip to content

One standard library

Novis has one standard library, Core. Each class covers one kind of value or one task, such as Core\Str for strings and Core\Arr for arrays:

<?nvs
// This program uses a few classes of `Core`, the library that comes with Novis.
// The first argument of each method is the string or array it works on.
string $text = 'red,green,blue';
// `Core\Str` has the methods for strings.
array<string> $colors = Core\Str::split($text, ',');
echo Core\Str::upper($colors[0]), "\n";
// `Core\Arr` has the methods for arrays.
array<string> $sorted = Core\Arr::sort($colors);
echo Core\Str::join($sorted, ' '), "\n";
// `Core\Arr::count` returns the number of items in an array. This prints `3`.
echo Core\Arr::count($colors), "\n";
Output
RED
blue green red
3

Each task has one method. The first argument is always the value the method works on. Options come last. So you can guess the order of the arguments.

Core also has an HTTP client, a database layer, JSON, CSV and a test library. A new project needs no packages for these tasks.

Read more in Reference: all Core classes.