oskarstark / trimmed-non-empty-string
This library provides a value object which ensures a trimmed non empty string.
Installs: 664 660
Dependents: 14
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: >=8.0
- symfony/string: ^5.0 || ^6.0 || ^7.0
- webmozart/assert: ^1.0
Requires (Dev)
- ergebnis/test-util: ^1.4
- friendsofphp/php-cs-fixer: 2.18
- phpunit/phpunit: ^8.5 || ^9.0
README
This library provides a value object which ensures a trimmed non empty string.
Installation
composer require oskarstark/trimmed-non-empty-string
Usage
<?php declare(strict_types=1); namespace App\Domain\Value\Name; use OskarStark\Value\TrimmedNonEmptyString; final class Name { private string $value; private function __construct(string $value) { $this->value = TrimmedNonEmptyString::fromString($value)->toString(); } public static function fromString(string $value): self { return new self($value); } public function toString(): string { return $this->value; } }