webservco / data
A PHP component/library.
v1.1.0
2025-02-17 13:56 UTC
Requires
- php: ^8.4
Requires (Dev)
- pds/skeleton: ^1
- phan/phan: ^5
- php-parallel-lint/php-console-highlighter: ^1
- php-parallel-lint/php-parallel-lint: ^1
- phpcompatibility/php-compatibility: ^9
- phpmd/phpmd: ^2
- phpstan/phpstan: ^2
- phpstan/phpstan-deprecation-rules: ^2
- phpstan/phpstan-phpunit: ^2
- phpstan/phpstan-strict-rules: ^2
- phpunit/phpunit: ^10
- rector/rector: ^2
- slevomat/coding-standard: ^8
- squizlabs/php_codesniffer: ^3
- vimeo/psalm: ^6
- webservco/coding-standards: ^1
- webservco/component-common: ^1
README
A PHP component/library for data handling.
Data transfer
Interfaces
DataTransferInterface
.
Objects
Key / Value objects
StringString
Data extraction
Scalar data extraction service
Array data extraction service
Note: for multidimensional arrays, array key can also be a special formatted string using /
as separator.
Example: "foo/bar/baz".
Two service types available:
DataExtractionService
NonEmptyDataExtractionService
As above except validates data to be non-empty.
Both service types can be used as:
Strict
Data must be of the type specified.
Loose
Data is cast to the specified type when extracting.
Example use case: database result where everything is a string.
Development
Run code validation
composer check:phpcs && composer check:phpstan && composer check:phpmd && composer check:psalm && composer check:phan
Run unit tests
composer test:dox
Demo
public/index.php