Download the PHP package oihana/php-core without Composer
On this page you can find all versions of the php package oihana/php-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download oihana/php-core
More information about oihana/php-core
Files in oihana/php-core
Package php-core
Short Description The Oihana PHP Core library
License MPL-2.0
Homepage https://github.com/BcommeBois/oihana-php-core
Informations about the package php-core
Oihana PHP - Core library

A lightweight and modular core library for modern PHP development. Designed for clarity, extensibility, and performance, with a consistent, functional-style API.
Table of Contents
- β¨ Core Packages
- π Documentation
- π¦οΈ Installation
- π‘ Features
- π Quick Start
- π§ͺ Examples
- β Running Unit Tests
- π€ Contributing
- π§Ύ License
- π€ About the author
Core Packages
The library provides a suite of pure, side-effect-free utility functions organized into logical namespaces. Hereβs a summary of what each package offers:
| Namespace | Description |
|---|---|
oihana\core\accessors |
Provides unified functions (get, set, has, delete) to safely access and manipulate nested data in both arrays and objects using dot notation. |
oihana\core\arrays |
A rich suite of utilities for array manipulation, including transformations, access, and structural analysis. |
oihana\core\bits |
A set of utilities for bit masks manipulation. |
oihana\core\callables |
A set of utilities for functions and callable definitions. |
oihana\core\date |
Helpers for date formatting and validation. |
oihana\core\documents |
Utilities for placeholder resolution and document formatting. |
oihana\core\env |
Functions to detect the current environment (CLI, Docker, OS) and PHP settings. |
oihana\core\json |
Helpers for advanced JSON serialization and flag validation. |
oihana\core\maths |
Functions for smart numeric rounding operations (ceil, floor, round). |
oihana\core\numbers |
Utilities for handling numbers, such as clamping a value within a specific range. |
oihana\core\objects |
Lightweight helpers for object manipulation, like compressing and deep-setting values. |
oihana\core\options |
Provides Enums for configuring function behaviors (e.g., CompressOption). |
oihana\core\reflections |
Provides reflection utilities to inspect functions and their properties. |
oihana\core\strings |
A comprehensive set of tools for string formatting, case conversion, validation, and generation. |
oihana\core (Utils) |
General-purpose utilities, such as normalize(), ifNull(), isLiteral() and toNumber(). |
Documentation
Full project documentation is available at: π https://bcommebois.github.io/oihana-php-core
- Changelog: CHANGELOG.md
- License: MPL-2.0
Installation
Requires PHP 8.4+
Install via Composer:
Features
The oihana/php-core library provides pure utility functions (no side effects), organized into logical, reusable packages:
π§Ύ Accessors (oihana\core\accessors)
Unified access for both arrays and objects:
- Read:
getKeyValue() - Write:
setKeyValue() - Delete:
deleteKeyValue()(supports wildcards:*,foo.bar.*) - Exists:
hasKeyValue() - Validation and traversal:
assertDocumentKeyValid(),resolveReferencePath()
π’ 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()now()
π Documents (oihana\core\documents)
Template and placeholder resolution:
formatDocument()resolvePlaceholders()
π» Env (oihana\core\env)
Environment detection helpers:
- OS detection:
isLinux(),isMac(),isWindows() - Environment type:
isCli(),isWeb(),isDocker() - PHP info:
phpVersion(),isExtensionLoaded()
𧬠JSON (oihana\core\json)
Advanced JSON utilities:
deepJsonSerialize()isValidJsonEncodeFlags(),isValidJsonDecodeFlags()
β Maths (oihana\core\maths)
Smart numeric rounding helpers:
ceilValue(),floorValue(),roundValue()- Float noise:
shedFloatNoise()β sheds the binary noise of a computed figure by significant digits, never a business rounding ;scale:reckons them on the largest term of a sum whose terms cancel - Geolocation:
haversine(),bearing()
π’ Numbers (oihana\core\numbers)
- Range clamping:
clip()
π§± Objects (oihana\core\objects)
Lightweight object manipulation:
compress()β remove null/empty valuesset()β deep set a value in a nested structuretoAssociativeArray()
βοΈ Reflections (oihana\core\reflections)
- Function analysis:
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 (oihana\core)
General-purpose helpers:
ifNull()β return a fallback if a value is nullisLiteral()β check if a value is a literal
Quick Start
Most helpers are loaded via Composer autoload. You can import functions directly using use function and call them.
Examples
Accessors: work with arrays and objects
Arrays: reading and transforming
Strings: formatting and cases
Objects: cleaning data
Date: formatting
Numbers: clamping a value
Running Unit Tests
To run all tests:
To run a specific test file:
Static Analysis (PHPStan)
The library is analysed with PHPStan at the strictest level (max). The configuration lives in phpstan.neon.
Findings that pre-date the introduction of static analysis are frozen in phpstan-baseline.neon, so the command is green and only reports new issues β keeping every future change held to the max bar. The goal is to shrink the baseline over time: once you legitimately fix some of its entries, regenerate it with
PHPStan does not need Xdebug and is independent from the test suite.
Contributing
Contributions are welcome! Whether you're fixing a bug, improving an existing feature, or proposing a new one, your help is appreciated.
Please feel free to:
- Report a bug: If you find a bug, please open an issue and provide as much detail as possible.
- Suggest an enhancement: Have an idea to make this library better? Open an issue to discuss it.
- Submit a pull request: Fork the repository, make your changes, and open a pull request. Please ensure all tests are passing before submitting.
You can find the issues page here: https://github.com/BcommeBois/oihana-php-core/issues
License
This project is licensed under the Mozilla Public License 2.0 (MPL-2.0).
About the author
- Author : Marc ALCARAZ (aka eKameleon)
- Mail : [email protected]
- Website : http://www.ooop.fr
All versions of php-core with dependencies
ext-bcmath Version *
ext-intl Version *
ext-posix Version *
psr/container Version ^2.0
welpie21/cbor.php Version ^2.0