Skip to content

Foundation

Raxos Foundation is the small, dependency free package that underpins every other Raxos library. It has no dependencies on other Raxos packages and provides the primitives that keep the rest of the ecosystem consistent: magic property and array access traits, a functional Option type for representing optional values, an IP value object, a Singleton registry, and a set of static Util classes for arrays, colors, math, strings, XML, reflection, timing and debug output. A handful of global functions round out the package.

Highlights

Explore by category

Quick example

php
<?php
declare(strict_types=1);

use Raxos\Foundation\Network\IP;
use Raxos\Foundation\Option\Option;

$ip = IP::parse('203.0.113.10');

$name = Option::fromValue($ip?->value)
    ->map(static fn(string $value): string => "client@{$value}")
    ->getOrElse('client@unknown');

Installation

Install the package with Composer. See installation for the required PHP version and extensions.

shell
composer require raxos/foundation