Oihana PHP

Oihana PHP

Oihana PHP Core is a lightweight, modular core library for modern PHP development.
Designed with clarity, extensibility, and performance in mind.

🔗 Project on GitHub

View the full source code and contribute on GitHub:

https://github.com/BcommeBois/oihana-php-core

📦 Installation

This library requires PHP 8.4+ and is installed 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

Run all unit tests:

composer run-script test

Run a specific test:

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

📄 License

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

👤 About the Author

Table of Contents

Namespaces

oihana

Search results