Search by

phprise / common-value-object

wallaceSFesdras-schonevald

Extended PHP types with common value objects applying OTAKU philosophy

Package info

github.com/phprise-foundation/common-value-object

pkg:composer/phprise/common-value-object

Statistics

Installs: 113

Dependents: 6

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-01-06 21:00 UTC

This package is auto-updated.

Last update: 2026-10-25 20:31:26 UTC


README

Extended PHP types with common value objects applying OTAKU philosophy.

Installation

composer require phprise/common-value-object

Usage

ArrayObject

ArrayObject extends the native PHP ArrayObject but strictly adheres to the project's philosophy, providing utility methods for key replacement and strict type handling.

use Phprise\Common\ValueObject\ArrayObject;

$data = new ArrayObject(['old_key' => 'value']);

// Replace a key
$data->replaceKey('old_key', 'new_key');

echo $data['new_key']; // Outputs: value

StringObject

StringObject is an immutable wrapper around strings, providing expressive methods for text manipulation and case conversion.

use Phprise\Common\ValueObject\StringObject;

$string = new StringObject('hello world');

echo $string->toCamel();  // helloWorld
echo $string->toSnake();  // hello_world
echo $string->toKebab();  // hello-world
echo $string->toPascal(); // HelloWorld
echo $string->toTitle();  // Hello World
echo $string->toUpper();  // HELLO WORLD

Philosophy

Please read OTAKU Manifesto to learn more about our philosophy.

License

MIT License

Contributing

Check CONTRIBUTING.md to learn more about our contributing guidelines.

Code of Conduct

Check CODE_OF_CONDUCT.md to learn more about our code of conduct.

Security

Check SECURITY.md to learn more about our security policy.