flaphl/support

Mathematical oddity abstractions pulled from Flaphl elements.

Installs: 3

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/flaphl/support

v1.0.0 2025-10-17 16:31 UTC

This package is auto-updated.

Last update: 2025-10-17 16:36:32 UTC


README

Mathematical oddity abstractions and framework utilities pulled from Flaphl elements.

Installation

composer require flaphl/support

Examples

Mathematical Oddities

use Flaphl\Element\Support\Oddity\MathOddity;

// Calculate factorial with overflow protection
echo MathOddity::factorial(7); // 5040

// Check if number is prime
echo MathOddity::isPrime(17) ? 'prime' : 'not prime'; // prime

// Find perfect numbers
echo MathOddity::isPerfect(28) ? 'perfect' : 'not perfect'; // perfect

PSR Compliance Checking

use Flaphl\Element\Support\Oddity\PsrCompliantCheckOddity;

// Validate PSR-4 namespace
$valid = PsrCompliantCheckOddity::isPsrCompliantNamespace('Flaphl\\Element\\Support');

// Check class name compliance
$valid = PsrCompliantCheckOddity::isPsrCompliantClassName('MyClass');

// Validate autoload path mapping
$valid = PsrCompliantCheckOddity::validatePsrAutoloadPath(
    'Flaphl\\Element\\Support\\MyClass',
    'Flaphl/Element/Support/MyClass.php'
);

Modular Traits

use Flaphl\Element\Support\Traits\PrimeTrait;

class MyMathClass 
{
    use PrimeTrait;
}

$math = new MyMathClass();
echo implode(', ', $math->primesUpTo(20)); // 2, 3, 5, 7, 11, 13, 17, 19

Requirements

  • PHP 8.2+

License

MIT