phore / core
Phore core library
v1.3.1
2026-11-26 15:44 UTC
Requires
- php: >=8.0
Requires (Dev)
- ext-json: *
- ext-sodium: *
- ext-yaml: *
- phpspec/phpspec: ^8.3
Suggests
- ext-json: Json encoding parsing
- ext-sodium: Encryption functions
- ext-yaml: Yaml encoding parsing
Provides
None
Conflicts
None
Replaces
None
README
Install
composer requre phore/core
Basic usage
Pluck
$data = ["some"=>["path"=>"data"]]; assert( "data" === phore_pluck("some.path", $data) ); assert( "data" === phore_pluck(["some", "path"], $data) ); assert( "fail" === phore_pluck("unknown", $data, "fail") ); phore_pluck("unknown", $data, new InvalidArgumentException("path missing")); // if default is array, phore_pluck will ensure to return array assert ( [] == phore_pluck("some.path", $data, []) );
Transform Array
$input = ["a", "remove"]; $out = phore_array_transform($input, function ($key, $value) { if ($key == "remove") return null; return ["x"=>"y"]; }); assert([["x"=>"y"]] == $out);
Text functions
phore_text_unindent(string $input)
phore_random_str()
Wrapper around libsodium and
Tests
Install the PHP extensions yaml, sodium, json and mbstring, then run:
composer install
composer test
The test suite uses PHPSpec (PHP 8.2 or newer for development) and runs with all PHP warnings and deprecations enabled, including on PHP 8.5.