PHPackages                             berlioz/helpers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. berlioz/helpers

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

berlioz/helpers
===============

Many PHP functions used in the Berlioz framework, which you can use in your developments.

v1.14.0(4d ago)091.0k—5.4%414MITPHPPHP ^7.3 || ^8.0CI passing

Since Feb 17Pushed 4d ago2 watchersCompare

[ Source](https://github.com/BerliozFramework/Helpers)[ Packagist](https://packagist.org/packages/berlioz/helpers)[ Docs](https://getberlioz.com)[ RSS](/packages/berlioz-helpers/feed)WikiDiscussions 1.x Synced 2d ago

READMEChangelog (10)Dependencies (3)Versions (29)Used By (14)

Berlioz Helpers (PHP Functions)
===============================

[](#berlioz-helpers-php-functions)

[![Latest Version](https://camo.githubusercontent.com/92a276b8eb46cdacb25582c7c50bb034e6a384b8b440a187180fb6b6342fc6b0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6265726c696f7a2f68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://github.com/BerliozFramework/Helpers/releases)[![Software license](https://camo.githubusercontent.com/f03dfbbc9f73064b90dbd63b6bc85b12d527acb4886c29c23e6bee3fa99d7442/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4265726c696f7a4672616d65776f726b2f48656c706572732e7376673f7374796c653d666c61742d737175617265)](https://github.com/BerliozFramework/Helpers/blob/1.x/LICENSE)[![Build Status](https://camo.githubusercontent.com/8c74e069b66709ccfbce369c05dfbc622bab0c5018e3279ebdcd83b67ac4d356/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4265726c696f7a4672616d65776f726b2f48656c706572732f74657374732e796d6c3f6272616e63683d312e78267374796c653d666c61742d737175617265)](https://github.com/BerliozFramework/Helpers/actions/workflows/tests.yml?query=branch%3A1.x)[![Quality Grade](https://camo.githubusercontent.com/a6dd4943713535e635ee75c0dbf62ac6af0bc37946a8877ac5bbb2903f9bbeae/68747470733a2f2f696d672e736869656c64732e696f2f636f646163792f67726164652f63663765393437653664646634646132386535343034303262663038643935372f312e782e7376673f7374796c653d666c61742d737175617265)](https://www.codacy.com/manual/BerliozFramework/Helpers)[![Total Downloads](https://camo.githubusercontent.com/14e4406b0354d141ef4edd8645797fd1c6be54c74ed75ae2d0b9898dd4994c59/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6265726c696f7a2f68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/berlioz/helpers)

Many PHP functions used in the Berlioz framework, which you can use in your developments.

Array
-----

[](#array)

All array path methods support the following path formats:

- Dot notation: `foo.bar.baz`
- Bracket notation: `foo[bar][baz]`
- JSON Pointer ([RFC 6901](https://www.rfc-editor.org/rfc/rfc6901)): `/foo/bar/baz`
- `b_array_is_list(array $array): bool`

    Is sequential array?
- `b_array_column(array $array, int|string|\Closure|null $column_key, int|string|\Closure|null $index_key = null): array`

    Get values from a single column in the input array.

    Difference between native array\_column() and b\_array\_column() is that b\_array\_column() accept a \\Closure in keys arguments.
- `b_array_merge_recursive(array $arraySrc, array ...$arrays): array`

    Merge two or more arrays recursively.

    Difference between native array\_merge\_recursive() is that b\_array\_merge\_recursive() do not merge strings values into an array.
- `b_array_traverse_exists(&$mixed, string $path): bool`

    Traverse array with path and return if path exists.
- `b_array_traverse_get(&$mixed, string $path, $default = null): mixed|null`

    Traverse array with path and get value.
- `b_array_traverse_set(&$mixed, string $path, $value): bool`

    Traverse array with path and set value.
- `b_array_traverse_unset(&$mixed, string $path): bool`

    Traverse array with path and unset value.
- `b_array_simple(array $array, ?string $prefix = null): array`

    Simplify a multidimensional array to simple.
- `b_array_nested(array $array): array`

    Transform a simple array with dot/bracket notation keys into a multidimensional array.

File
----

[](#file)

- `b_human_file_size($size, int $precision = 2): string`

    Get a human see file size.
- `b_size_from_ini(string $size): int`

    Get size in bytes from ini conf file.
- `b_resolve_absolute_path(string $srcPath, string $dstPath): ?string`

    Resolve absolute path from another.
- `b_resolve_relative_path(string $srcPath, string $dstPath): string`

    Resolve relative path from another.
- `b_fwritei(resource $resource, string $str, ?int $length = null, ?int $offset = null): int|false`

    File write in insertion mode.
- `b_ftruncate(resource $resource, int $size, ?int $offset = null): bool`

    Truncate a part of file and shift rest of data.

Network
-------

[](#network)

- `b_net_validate_ip(string $ip): bool`

    Is valid IP (v4 or v6)?
- `b_net_validate_ipv4(string $ip): bool`

    Is valid IP v4?
- `b_net_validate_ipv6(string $ip): bool`

    Is valid IP v6?
- `b_net_ip_version(string $ip): ?int`

    Get IP version (4, 6 or null if not a valid IP).
- `b_net_validate_netmask(string $mask, ?int $version = null): bool`

    Is valid netmask? Accepts a dotted netmask (e.g. `255.255.255.0`) or a CIDR prefix length (e.g. `24`). A valid netmask must be a contiguous sequence of high bits.
- `b_net_validate_cidr(string $cidr): bool`

    Is valid CIDR notation (e.g. `192.168.1.0/24`, `2001:db8::/32`)?
- `b_net_ip_in_network(string $ip, string $network): bool`

    Is IP in network? The network can be expressed in CIDR notation (`192.168.1.0/24`) or as `ip mask`(`192.168.1.0 255.255.255.0`).
- `b_net_range(string $network): array`

    Get network range. Returns an array with keys: `version`, `prefix`, `network`, `netmask`, `first`, `last`, `broadcast` (IPv4 only, `null` for IPv6) and `count` (int, or numeric string for large IPv6 ranges).
- `b_net_forwarded_for_parse(string $header): array`

    Split and trim an `X-Forwarded-For` header value into a list of IP addresses, stripping optional ports (including the `[ipv6]:port` form) and discarding invalid entries. The list keeps header order (left-most = claimed client, right-most = closest proxy).
- `b_net_client_ip(array $trustedProxies = [], ?array $server = null, string $header = 'X-Forwarded-For'): ?string`

    Determine the real client IP from server parameters (defaults to `$_SERVER`). Returns `REMOTE_ADDR` unless the request comes from a trusted proxy (exact IP or CIDR range), in which case the forwarded header chain is walked from right to left and the first non-trusted hop is returned. If `REMOTE_ADDR` is not trusted, the forwarded header is ignored.

Object
------

[](#object)

- `b_get_property_value($object, string $property, &$exists = null): mixed`

    Get property value with getter method.
- `b_set_property_value($object, string $property, $value): bool`

    Set property value with setter method.

String
------

[](#string)

- `b_str_random(int $length = 12, int $options = B_STR_RANDOM_NUMBER | B_STR_RANDOM_SPECIAL_CHARACTERS | B_STR_RANDOM_NEED_ALL): string`

    Generate an random string.
- `b_nl2p(string $str): string`

    Surrounds paragraphs with "P" HTML tag and inserts HTML line breaks before all newlines; in a string.
- `b_str_remove_accents(string $str): string`

    Remove accents.
- `b_str_to_uri(string $str): string`

    String to URI string.
- `b_minify_html(string $str): string`

    Minify HTML string.
- `b_str_truncate(string $str, int $nbCharacters = 128, int $where = B_TRUNCATE_RIGHT, string $separator = '...'): string`

    Truncate string.
- `b_parse_str(string $str, bool $keepDots = true): array`

    Parses the string into variables.
- `b_pascal_case(string $str): string`

    Get pascal case convention of string.
- `b_camel_case(string $str): string`

    Get camel case convention of string.
- `b_snake_case(string $str): string`

    Get snake case convention of string.
- `b_spinal_case(string $str): string`

    Get spinal case convention of string.

###  Health Score

61

—

FairBetter than 98% of packages

Maintenance99

Actively maintained with recent releases

Popularity35

Limited adoption so far

Community25

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 95.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~83 days

Recently: every ~115 days

Total

29

Last Release

4d ago

PHP version history (2 changes)v1.0.0PHP ^7.1

v1.1.1PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18268216?v=4)[Ronan Giron](/maintainers/ElGigi)[@ElGigi](https://github.com/ElGigi)

---

Top Contributors

[![ElGigi](https://avatars.githubusercontent.com/u/18268216?v=4)](https://github.com/ElGigi "ElGigi (93 commits)")[![NicolasGESLIN](https://avatars.githubusercontent.com/u/205887?v=4)](https://github.com/NicolasGESLIN "NicolasGESLIN (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/berlioz-helpers/health.svg)

```
[![Health](https://phpackages.com/badges/berlioz-helpers/health.svg)](https://phpackages.com/packages/berlioz-helpers)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
