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

Reusable, composable object traits for PHP 8.4+.
๐ Documentation
User guides (FR + EN), with narrative explanations and examples:
| ๐ฌ๐ง English documentation | ๐ซ๐ท Documentation franรงaise |
|---|---|
| Getting started, container, identifiers, key-value, lazy/lockable, URI, strings, tips. | Dรฉmarrage, conteneur, identifiants, clรฉ-valeur, lazy/lockable, URI, chaรฎnes, astuces. |
Auto-generated API reference (phpDocumentor):
๐ https://bcommebois.github.io/oihana-php-traits
๐ง New to traits?
A trait is a reusable block of methods and properties that you "mix into" a
class with the use keyword. It is a way to share behaviour across classes
that don't share a common parent โ without copy-pasting and without
inheritance.
This package is a curated set of small, focused, tested traits: drop one into
your class with use and get container access, identifiers, lazy/lockable
state, key-value access, and more โ for free.
๐ Features
- ๐งฉ DI-container awareness โ
ContainerTrait. - ๐ค Lazy and ๐ lockable state โ
LazyTrait,LockableTrait. - ๐ Identifiers โ
IDTrait,QueryIDTrait. - ๐๏ธ Config and key-value access โ
ConfigTrait,KeyValueTrait,JsonOptionsTrait. - ๐ URI building, stringable and expression helpers โ
UriTrait,ToStringTrait,strings\ExpressionTrait. - ๐ข Default sorting and unsupported-operation guards โ
SortDefaultTrait,UnsupportedTrait. - ๐๏ธ Date format and timezone defaults โ
DateTrait. - ๐งช Full unit-test coverage ensuring reliability and maintainability.
๐ก Designed to be lightweight, testable, and compatible with any PHP 8.4+ project.
๐ฆ Installation
Requires PHP 8.4+
Install via Composer:
โ Tests & coverage
Run the full unit-test suite (PHPUnit, strict mode):
Run a single test case:
Measure coverage (requires Xdebug or PCOV):
The suite runs in strict mode and targets 100% line coverage.
๐งพ 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
๐ ๏ธ Generate the Documentation
We use phpDocumentor to generate the documentation into the ./docs folder.
Usage
Run the command :
๐ Related packages
- oihana/php-core โ core helpers and utilities used by this library.
- oihana/php-enums โ a collection of strongly-typed constant enumerations for PHP.
- oihana/php-reflect โ reflection and hydration utilities.
All versions of php-traits with dependencies
oihana/php-core Version dev-main
oihana/php-enums Version dev-main
oihana/php-exceptions Version dev-main
oihana/php-reflect Version dev-main
php-di/php-di Version ^7.0
psr/container Version ^2.0