PHPackages                             xenokore/utility - 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. xenokore/utility

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

xenokore/utility
================

General utility helpers

2.0.2(3y ago)01305MITPHPPHP &gt;=8.0

Since Mar 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/xenokore/xeno-utility)[ Packagist](https://packagist.org/packages/xenokore/utility)[ Docs](https://xenokore.com)[ RSS](/packages/xenokore-utility/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (8)Used By (5)

Xeno Utility Library
====================

[](#xeno-utility-library)

A library filled with utility functions.

ArrayHelper
-----------

[](#arrayhelper)

---

```
ArrayHelper::set(array &$array, string $key, mixed $value): array
```

Set an array item to a given value using "dot" notation.
If the given key is null, the entire array will be replaced. Returns the new array.

---

```
ArrayHelper::get(array $array, string $key, $default = null, bool $throw = false): mixed
```

Get an item from an array using "dot" notation.
If the `$throw` argument is set to true an `ArrayKeyNotFoundException` is thrown instead of returning the default value.

---

```
ArrayHelper::isAccessible(mixed $value): bool
```

Determine whether a given value is *array accessible*.
Checks if the value is an instance of `\ArrayAccess`.

---

```
ArrayHelper::exists(array $array, string|int $key)
```

Determine if a given key exists in the provided array.

---

```
ArrayHelper::convertDotNotationToArray(array $array): array
```

Creates a multidimensional array based on an array of dotnotation keys.
Useful for configuration arrays.

Example:

```
[
    'a.b.c' => 'value'
]

```

Turns into

```
[
    'a' => [
        'b' => [
            'c' => 'value'
        ]
    ]
]

```

---

```
ArrayHelper::convertArrayToDotNotation(array $array): array
```

Convert multidimensional array to 2D array with dotnotation keys.

Useful for configuration arrays.

Example:

```
[
    'a' => [
        'b' => [
            'c' => 'value'
        ]
    ]
]

```

Turns into

```
[
    'a.b.c' => 'value'
]

```

---

```
ArrayHelper::moveToTop(array &$array, string $key): void
```

Move an array item to the start of the array.

---

```
ArrayHelper::moveToBottom(array &$array, string $key): void
```

Move an array item to the end of the array.

---

```
ArrayHelper::mergeRecursiveDistinct(array $array1, array $array2): array
```

Merge 2 arrays recursively and replaces distinct non-array values.

---

```
ArrayHelper::getChecksum(array $array, bool $sort = false): ?string
```

Get a checksum of the given array.

---

```
ArrayHelper::getValueBasedOnCurrentDay(array $array): mixed
```

Gets a value from an array based on the current day. Each day the value shifts to the next one. Maximum array size is around 20 million. (`Ymd` as an int).

---

ClassHelper
-----------

[](#classhelper)

```
ClassHelper::getClassConstant(object $class, $value, ?string $prefix = null, bool $remove_prefix = true): ?string
```

Get the name of a constant based on value.
Can be given a prefix to narrow the search.

---

```
ClassHelper::getClassInfoFromFile(string $file_path): array
```

Get the info of a class by filepath.
Returns an array with the class name and the full namespace.
Does not use reflection and does not initiate the class.

---

```
ClassHelper::getClassNameFromFile(string $file_path): ?string
```

Get the class name from a file containing a class.
The namespace is not included.

---

```
ClassHelper::getNamespaceFromFile(string $file_path): ?string
```

Get the namespace from a file containing a class.

---

```
ClassHelper::getFullClassNameFromFile(string $file_path): ?string
```

Get the full class name from a file containing a class. The returned string contains the namespace and class name.

---

```
ClassHelper::getMethodCodeFromClass(object $class, string $method_name, bool $include_function_definition = false): ?string
```

Get the raw code from a method of a class.

---

```
ClassHelper::callPrivateMethod(object $class, string $method_name, array ...$arguments): mixed
```

Call a private method of a class.
Useful for unit testing internal workings.

---

DirectoryHelper
---------------

[](#directoryhelper)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~232 days

Recently: every ~346 days

Total

7

Last Release

1240d ago

Major Versions

1.1.0 → 2.0.02022-12-25

PHP version history (2 changes)1.1.0PHP &gt;=7.3

2.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4f952a864ff95e6dc68693bf6a5fff8320a3511840d1b9f1a0722e8f41b5385a?d=identicon)[Yani](/maintainers/Yani)

---

Top Contributors

[![yani](https://avatars.githubusercontent.com/u/6956790?v=4)](https://github.com/yani "yani (1 commits)")

---

Tags

helperutility

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/xenokore-utility/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[bocharsky-bw/arrayzy

A native PHP arrays easy manipulation library in OOP way.

38425.4k](/packages/bocharsky-bw-arrayzy)[chillerlan/php-settings-container

A container class for immutable settings objects. Not a DI container.

3427.3M21](/packages/chillerlan-php-settings-container)[bocharsky-bw/file-naming-resolver

A lightweight library which helps to resolve a file/directory naming of uploaded files using various naming strategies.

1134.9k](/packages/bocharsky-bw-file-naming-resolver)

PHPackages © 2026

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