phprise/common-value-object

Extended PHP types with common value objects applying OTAKU philosophy

Installs: 5

Dependents: 4

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/phprise/common-value-object

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

This package is auto-updated.

Last update: 2026-01-07 02:58:57 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 PHILOSOPHY.md 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.

Changelog

Check CHANGELOG.md for more information.