phore / core
Phore core library
Installs: 12 243
Dependents: 25
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 2
Open Issues: 0
Requires
- php: >=7.1
Requires (Dev)
- ext-json: *
- ext-sodium: *
- ext-yaml: *
- phpunit/phpunit: *
Suggests
- ext-json: Json encoding parsing
- ext-sodium: Encryption functions
- ext-yaml: Yaml encoding parsing
This package is auto-updated.
Last update: 2024-10-29 01:09:57 UTC
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