PHPackages                             safronik/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. safronik/helpers

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

safronik/helpers
================

Different helpers, such as: IP, Array, Data, Reflection

0.2.0(2mo ago)018MITPHPPHP &gt;=8.2

Since Apr 19Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/safronik/project-helpers)[ Packagist](https://packagist.org/packages/safronik/helpers)[ Docs](https://github.com/Safronik/project-helpers)[ RSS](/packages/safronik-helpers/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (6)Used By (0)

safronik/helpers
================

[](#safronikhelpers)

 **A PHP library to ease coder life in a different ways**

About
=====

[](#about)

Helps to operate with such thing as:

- Array
- Buffer
- Data
- Dir
- DNS
- HTTP
- IP
- Page
- Reflection
- String
- Surrounding
- Time
- Version

Installation
============

[](#installation)

The preferred method of installation is via Composer. Run the following command to install the package and add it as a requirement to your project's `composer.json`:

```
composer require safronik/helpers
```

or just download files or clone repository (in this case you should bother about autoloader)

Usage
=====

[](#usage)

[HelperArray](src%2FHelperArray.php)
------------------------------------

[](#helperarray)

```
HelperArray::insert( $array_passed by_link, $insert_position, $insert_value); // Modifies the array $array. Paste $insert on $position
```

[HelperData](src%2FHelperData.php)
----------------------------------

[](#helperdata)

```
$array_from_json = HelperData::unpackIfJSON( $json_data );
$token           = HelperData::createToken(); // Generates UUID
```

[HelperIP](src%2FHelperIP.php)
------------------------------

[](#helperip)

```
get([ip_types: array|string[] = [...]], [v4_only: bool = true]): array|mixed|null
getDecimal([ip: null|string = null]): int
isPrivateNetwork(ip: string, [ip_type: string = 'v4']): bool
isIPInMask(ip: string, cidr: array|string, [ip_type: string = 'v4'], [xtet_count: int = 0]): bool
convertLongMaskToNumber(long_mask: int): int
validate(ip: string): bool|string
cidrValidate(cidr: string): bool
normalizeIPv6(ip: string): string
reduceIPv6(ip: string): string
resolveIP(ip): string
```

[HelperReflection](src%2FHelperReflection.php)
----------------------------------------------

[](#helperreflection)

```
// Scan directory and its subdirectories. Could filter the set by different parameters
HelperReflection::getClassesFromDirectory(
    directory: string,                      // Directory path
    namespace: string,                      // Directory namespace
    [exclusions: string[] = [...]],         // Exclusions. Full strict comparison
    [filter: string = ''],                  // Positive filter (only string contains will be present in the result set)
    [recursive: bool = false],              // Scan subdirectories
    [skip_infrastructure: bool = true],     // Skip classes starts with '_' (underscore symbol)
    [filter_callback: callable|null = null] // Any callback you want to filter the result set. Other methods of self could be passed as a callback filter
): array

// Filter everything except final classes from the given set
HelperReflection::filterFinalClasses(classes): array

// Filter everything except interfaces from the given set
HelperReflection::getInterfacesFromDirectory(classes): array

// Check if the given class use specific trait
HelperReflection::isClassUseTrait(classname: string, trait: string): bool

// Gets class traits
HelperReflection::getClassTraits(classname: string): array

// Filter everything except classes which are implement specific interface from the given set
HelperReflection::filterClassesByInterface(classes: array, interface: string): array

// // Check if the given class implements specific interface
HelperReflection::isClassHasInterface(class: object|string, interface: string): bool
```

[BufferHelper.php](src%2FBufferHelper.php)
------------------------------------------

[](#bufferhelperphp)

```
getCSVMap(&csv: string): array
parseCSV(&scv_string: string): array
parseNSV(nsv_string: string): string[]
convertCSVToArray(&csv: string, [map: array = [...]]): array
convertCSVLineToArray(&csv: string, [map: array = [...]], [stripslashes: bool = false]): array
cleanUpCSV(&buffer: array): array
popCSVLine(&csv: string): string
```

[DirHelper.php](src%2FDirHelper.php)
------------------------------------

[](#dirhelperphp)

```
isExist(path): bool
isEmpty(path): bool
create(path): void
```

[DNSHelper.php](src%2FDNSHelper.php)
------------------------------------

[](#dnshelperphp)

```
resolveHost(host: string): string
```

[HTTPHelper.php](src%2FHTTPHelper.php)
--------------------------------------

[](#httphelperphp)

```
http__request(url: string, [data: array = [...]], [presets: array|null|string = null], [opts: array = [...]]): array|string[]|bool|int|string
http__request__get_content(url: string): array|string[]|bool|int|mixed|string
http__request__get_response_code(url: string): array|string[]|bool|int|mixed|string
http__get_data_from_remote_gz(url: string): array|false|mixed|string
get_data_from_local_gz(path: string): array|string[]|mixed|string
http__download_remote_file(url, tmp_folder): array|string[]|bool|int|string
http__download_remote_file__multi(urls: array, [write_to: string = '']): array|string[]
```

[PageHelper.php](src%2FPageHelper.php)
--------------------------------------

[](#pagehelperphp)

```
hasError(string_page): bool
```

[StringHelper.php](src%2FStringHelper.php)
------------------------------------------

[](#stringhelperphp)

```
removeNonUTF8(data: array|object|string): array|object|string
toUTF8(data: array|object|string, [data_codepage: null|string = null]): array|object|string
fromUTF8(obj: array|object|string, [data_codepage: null|string = null]): mixed
```

[SurroundingHelper.php](src%2FSurroundingHelper.php)
----------------------------------------------------

[](#surroundinghelperphp)

```
isWindows(): bool
isExtensionLoaded(extension_name): bool
```

[TimeHelper.php](src%2FTimeHelper.php)
--------------------------------------

[](#timehelperphp)

```
getIntervalStart(interval: int): int
```

[VersionHelper.php](src%2FVersionHelper.php)
--------------------------------------------

[](#versionhelperphp)

```
isCorrectSemanticVersion(version: string): bool
standardizeVersion(version): string
compare(version1: string, version2: string): int
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance84

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 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 ~169 days

Total

5

Last Release

83d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c69e7608cd7b2fe530ef65731dc64b353ece983e732764a99d0155beac3275d9?d=identicon)[Safronik](/maintainers/Safronik)

---

Top Contributors

[![safronik](https://avatars.githubusercontent.com/u/16255344?v=4)](https://github.com/safronik "safronik (12 commits)")

---

Tags

helperarraydatareflectionIP

### Embed Badge

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

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

###  Alternatives

[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k295.3M2.5k](/packages/symfony-property-access)[jbzoo/data

An extended version of the ArrayObject object for working with system settings or just for working with data arrays

891.6M23](/packages/jbzoo-data)[bocharsky-bw/arrayzy

A native PHP arrays easy manipulation library in OOP way.

38425.4k](/packages/bocharsky-bw-arrayzy)[spatie/array-functions

Some handy array helpers

24561.1k2](/packages/spatie-array-functions)[minwork/array

Pack of advanced array functions specifically tailored for: associative (assoc) array, multidimensional array, array of objects and handling nested array elements

66256.1k5](/packages/minwork-array)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)

PHPackages © 2026

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