https://github.com/phore/phore-core
Core library
https://github.com/phore/phore-core
phore
Last synced: 2 months ago
JSON representation
Core library
- Host: GitHub
- URL: https://github.com/phore/phore-core
- Owner: phore
- Created: 2018-09-05T09:50:13.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2026-01-01T15:05:41.000Z (6 months ago)
- Last Synced: 2026-02-20T18:33:03.476Z (4 months ago)
- Topics: phore
- Language: PHP
- Homepage: https://infracamp.org/project/phore/
- Size: 156 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Phore core library
[](https://github.com/phore/phore-core/actions)
## Install
```
composer requre phore/core
```
## Basic usage
### Pluck
```php
$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
```php
$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