oihana / php-core
The Oihana PHP Core library
Requires
- php: >=8.4
- ext-openssl: *
- monolog/monolog: ^3.9
- php-di/php-di: ^7.0
- psr/log: ^3.0
- psr/simple-cache: ^3.0
Requires (Dev)
- nunomaduro/collision: ^8.8
- phpunit/phpunit: ^12
README
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
- Author : Marc ALCARAZ (aka eKameleon)
- Mail : marc@ooop.fr
- Website : http://www.ooop.fr