PHPackages                             bunesk/php-helper - 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. bunesk/php-helper

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

bunesk/php-helper
=================

A bunch of useful php helper classes.

1.0.0(2y ago)03MITPHPPHP &gt;=7.1

Since Mar 4Pushed 2y ago1 watchersCompare

[ Source](https://github.com/bunesk/php-helper)[ Packagist](https://packagist.org/packages/bunesk/php-helper)[ RSS](/packages/bunesk-php-helper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

PHP Helper
==========

[](#php-helper)

A bunch of useful php helper classes.

Helpers
-------

[](#helpers)

### ArrayHelper

[](#arrayhelper)

FunctionsDescription`firstKey(array $array): mixed`Returns the key of the first element of an array.`firstValue(array $array): mixed`Returns the value of the first element of an array.`lastKey(array $array): mixed`Returns the key of the last element of an array.`lastValue(array $array): mixed`Returns the value of the last element of an array.`isCountable(mixed $value): bool`Verifies that the variable is countable.`isList(array $array): bool`If the array is a list by just containing incremental numeric keys.`isAssociative(array $array): bool`If the array is associative by not just containing incremental numeric keys.`objectToArray($object): mixed`Converts an object to an array.`mergeRecursiveDistinct(array $array): array`Merge arrays recursive by overwriting the value in the first array with the duplicate value in the second array.### DateTimeHelper

[](#datetimehelper)

FunctionsDescription`phpToJavascript(array $array): int`Converts a php unix timestamp to a javascript timestamp in milliseconds.`javascriptToPhp(array $array): int`Converts a javascript unix timestamp to a php timestamp in seconds.`timeMillis(): int`Returns the current javascript unix timestamp in milliseconds.`createFromFormat(string $format, string $datetime, ?\DateTimeZone $timezone = null): ?\DateTime`Parses a string into a new DateTime object according to the specified format.### NumberHelper

[](#numberhelper)

FunctionsDescription`fdiv(float $dividend, float $divisor): float`Divides two numbers, according to IEEE 754.`divisionWithRest(float $dividend, float $divisor): array`Divides two numbers and returns the result and the rest.`isEven(int $number): bool`If number is even.`isOdd(int $number): bool`If number is odd.`isDivideable(float $dividend, float $divisor): bool`If dividend is divideable by divisor with an even result.`fibonacci(int $limit): int[]`Get fibonacci numbers until limit.`quadraticFormula(float $a, float $b, float $c): float[]`Uses the quadratic formula to return the results of the function.`circleCircumference(float $radius): float`Get circumference of a circle by radius.`circleArea(float $radius): float`Get circle area by radius.### StringHelper

[](#stringhelper)

FunctionsDescription`contains(string $haystack, string $needle): bool`If haystack contains needle.`icontains(string $haystack, string $needle): bool`If haystack contains needle ignoring case.`startsWith(string $haystack, string $needle): bool`If haystack starts with needle.`istartsWith(string $haystack, string $needle): bool`If haystack starts with needle ignoring case.`endsWith(string $haystack, string $needle): bool`If haystack ends with needle.`iendsWith(string $haystack, string $needle): bool`If haystack ends with needle ignoring case.`indexOfAll(string $haystack, string $needle): array`Get the position of all occurrences of needle in haystack.`indexOf(string $haystack, string $needle, int $offset = 0): int`Get the position of the first occurrence of needle in haystack.`indexOfLast(string $haystack, string $needle, int $offset = 0): int`Get the position of the last occurrence of needle in haystack.`replaceArray(array $replace, string $string)`Replace multiple occurencies of a string with another using key-value-pairs.`ensureStart(string $string, string $prefix): string`Ensures that the string starts with prefix.`ensureEnd(string $string, string $suffix): string`Ensures that the string ends with suffix.`before(string $haystack, string $needle): string`Returns the part of haystack before the first occurrence of needle.`after(string $haystack, string $needle): string`Returns the part of haystack after the first occurrence of needle.`beforeLast(string $haystack, string $needle): string`Returns the part of haystack before the last occurrence of needle.`afterLast(string $haystack, string $needle): string`Returns the part of haystack after the last occurrence of needle.`snakeToCamelCase(string $string): string`Converts a `snake_case` string to `camelCase`.`kebabToCamelCase(string $string): string`Converts a `kebab-case` string to `camelCase`.`pascalToCamelCase(string $string): string`Converts a `PascalCase` string to `camelCase`.`camelToSnakeCase(string $string): string`Converts a `camelCase` string to `snake_case`.`kebabToSnakeCase(string $string): string`Converts a `kebab-case` string to `snake_case`.`pascalToSnakeCase(string $string): string`Converts a `PascalCase` string to `snake_case`.`snakeToKebabCase(string $string): string`Converts a `snake-case` string to `kebab-case`.`camelToKebabCase(string $string): string`Converts a `camelCase` string to `kebab-case`.`pascalToKebabCase(string $string): string`Converts a `PascalCase` string to `kebab-case`.`camelToPascalCase(string $string): string`Converts a `camelCase` string to `PascalCase`.`snakeToPascalCase(string $string): string`Converts a `snake_case` string to `PascalCase`.`toOsSeperator(string $path)`Changes `/` and `\` to the os seperator.`stripNamespaceFromClassName(string $class)`Strips the class name from a namespace to just return the class name.`removeLineBreaks(string $string, string $replaceWith = '')`Removes line breaks (`\n`, `\r`) from a string.`removeLineControls(string $string, string $replaceWith = '')`Removes line breaks (`\n`, `\r`, `\t`) from a string.`removeHtmlComments(string $string, string $replaceWith = '')`Removes html comments (``) from a string.`zeroFill(string $string, int $length)`Zero fills a number to reach the passed length.`breakToNewLine(string $string, bool $multiByte = true)`Does the opposite of `nl2br` by replacing breaks (``) with new lines (`\n`).`isAscii(string $string)`Whether a string is ASCII.`isUtf8(string $string)`Whether a string is UTF-8.`encodeUtf8(string $string, ?string $fromEncoding = null): ?string`Encodes a string to UTF-8.`decodeUtf8(string $string, string $toEncoding = 'ISO-8859-1'): ?string`Decodes a UTF-8 string.`jsonValidate(string $json, int $depth = 512, int $flags = 0)`If a string is a valid json representation.`parseUrl(string $url): array`Parses a url to an array of parts.`unparseUrl(array $parsedUrl): string`Unparses a url array back to a string.`parseCsv(string $csvString, string $delimiter = ',', bool $skipEmptyLines = true, bool $trimFields = true): array`Parses a csv string to an array.`multiByteReplace(string $needle, string $replacement, string $haystack)`Replaces needle in multi-byte haystack with replacement string.`multiByteTrim(string $string, ?string $characterMask = null)`Trims a multi-byte string by removing whitespaces etc.`multiBytePad(string $string, int $length, string $padString = ' ', int $padType = \STR_PAD_RIGHT, string $encoding = null)`Pad a multi-byte string to a certain length with another string.`multiByteReverse(string $string): string`Reverses the order of the characters of a multi-byte string.`multiByteSplit(string $string, int $length = 1, ?string $encoding = null): array`Splits a multi-byte string.`multiByteParseUrl(string $url): array`Parses a multi-byte url string to an array of parts.Curl
----

[](#curl)

FunctionsDescription`execute(string $url, array $options = [])`Executes a curl request. Returns an array with the structure: \[success =&gt; boolean, data =&gt; string\]Debug
-----

[](#debug)

FunctionsDescription`dd(...$vars): void`Dumps the passed variables and dies afterwards.`getClassInfo(object $class): array`Returns the name, parents, properties and methods for the class of the passed object.`getDefined(bool $categorizeConstants = false, bool $excludeDisabled = true): array`Returns the declared classes, interfaces, traits, constants, functions and variables.Mysql
-----

[](#mysql)

FunctionsDescription`executeQuery(\mysqli $mysqli, string $sql, ?array $params = null): ?\mysqli_stmt`Prepares an SQL statement, binds parameters, executes, and returns the result.Random Generator
----------------

[](#random-generator)

FunctionsDescription`number(int $length): int`Generates a random integer number (max length: 18)`largeNumber(int $length): string`Generates a random number as string.`hexadecimalNumber(int $length): string`Generates a random hexadecimal number.`uuidV4(): string`Generates a random uuid version 4.`password(int $length = 12, bool $useUppercase = true, bool $useLowercase = true, bool $useNumbers = true, bool $useSpecialChars = false): string`Generates a random password.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

850d ago

### Community

Maintainers

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

---

Top Contributors

[![bunesk](https://avatars.githubusercontent.com/u/37407974?v=4)](https://github.com/bunesk "bunesk (2 commits)")

### Embed Badge

![Health badge](/badges/bunesk-php-helper/health.svg)

```
[![Health](https://phpackages.com/badges/bunesk-php-helper/health.svg)](https://phpackages.com/packages/bunesk-php-helper)
```

###  Alternatives

[wp-forge/wp-update-handler

A WordPress package for updating custom plugins and themes based on an API response from a custom update server.

14161.9k](/packages/wp-forge-wp-update-handler)[scotthuangzl/yii2-google-chart

A wraper for google chart

12190.4k2](/packages/scotthuangzl-yii2-google-chart)[bitgrave/barcode-generator

simple barcode generator base classes supporting 2d- and datamatrix barcodes

1313.7k](/packages/bitgrave-barcode-generator)

PHPackages © 2026

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