oihana/php-core

The Oihana PHP Core library

1.0.5 2025-07-10 08:08 UTC

This package is auto-updated.

Last update: 2025-07-20 15:10:15 UTC


README

Oihana Php Core

A lightweight and modular core library for modern PHP development. Designed for clarity, extensibility, and performance, with a consistent, functional-style API.

๐Ÿ“š Documentation

Full project documentation is available at: ๐Ÿ‘‰ https://bcommebois.github.io/oihana-php-core

Installation

Requires PHP 8.4+

Install via Composer:

composer require oihana/php-core

โœจ Features

The oihana/php-core library provides pure utility functions (no side effects), organized into logical, reusable packages:

๐Ÿ”ข Arrays (oihana\core\arrays)

Advanced array utilities:

  • Access and mutation: get(), set(), delete(), exists()
  • Transformations: flatten(), tail(), unique(), shuffle(), swap(), toArray(), stub()
  • Structure detection: isIndexed(), hasIntKeys(), hasStringKeys()

๐Ÿ“… Date (oihana\core\date)

Date manipulation and validation :

  • formatDateTime()
  • isDate(), isValidTimezone()

โž— Maths (oihana\core\maths)

Smart numeric rounding helpers:

  • ceilValue(), floorValue(), roundValue()

๐Ÿ”ข Numbers (oihana\core\numbers)

  • Range clamping: clip()

๐Ÿงฑ Objects (oihana\core\objects)

Lightweight object manipulation:

  • compress() โ€” remove null/empty values
  • set() โ€” deep set a value in a nested structure

๐Ÿง  Reflections (oihana\core\reflections)

Introspect callable/function definitions:

  • getFunctionInfo()

โœ๏ธ Strings (oihana\core\strings)

String formatting, case conversions, and utilities:

  • Case & slug:
  • camel(), snake(), kebab(), hyphenate(), lower(), latinize()
  • Format & identifiers:
  • fastFormat(), formatRequestArgs(), urlencode(), toString()
  • Validation:
  • isRegexp(), luhn()
  • Random generation:
  • randomKey()

โš™๏ธ Utils

  • ifNull() โ€” return a fallback if a value is null

โœ… Running Unit Tests

To run all tests:

composer run-script test

To run a specific test file:

composer run test ./tests/oihana/core/arrays/FlattenTest.php

๐Ÿงพ Licence

This project is licensed under the Mozilla Public License 2.0 (MPL-2.0).

๐Ÿ‘ค About the author