phprise / common-value-object
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
Requires
- php: ^8.4
- phprise/common-contract: ^1.0
Requires (Dev)
- phpunit/phpunit: ^12.5
- vimeo/psalm: ^6.14
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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.