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

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

kun391/laravel-helpers
======================

Laravel Helpers for Non-Laravel Projects

v1.0(9y ago)26.5kMITPHPPHP &gt;=5.4.0

Since Oct 19Pushed 9y ago1 watchersCompare

[ Source](https://github.com/kun391/laravel-helpers)[ Packagist](https://packagist.org/packages/kun391/laravel-helpers)[ RSS](/packages/kun391-laravel-helpers/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Laravel 5 Helpers for Non-Laravel Projects
------------------------------------------

[](#laravel-5-helpers-for-non-laravel-projects)

This project takes the useful [Laravel helper functions](http://laravel.com/docs/5.0/helpers) and allows you to use them in Non-Laravel projects.

All dependencies have been extracted out to a single helpers file. No need to import half of Symphony and Laravel to make these work.

Setup
-----

[](#setup)

In the `require` key of `composer.json` file add the following

```
"rappasoft/laravel-helpers": "dev-master"

```

Documentation
-------------

[](#documentation)

- [Arrays](#arrays)
    - [append\_config](#append_config)
    - [array\_add](#array_add)
    - [array\_build](#array_build)
    - [array\_divide](#array_divide)
    - [array\_dot](#array_dot)
    - [array\_except](#array_except)
    - [array\_fetch](#array_fetch)
    - [array\_first](#array_first)
    - [array\_last](#array_last)
    - [array\_flatten](#array_flatten)
    - [array\_forgot](#array_forgot)
    - [array\_get](#array_get)
    - [array\_has](#array_has)
    - [array\_only](#array_only)
    - [array\_pluck](#array_pluck)
    - [array\_pull](#array_pull)
    - [array\_set](#array_set)
    - [array\_where](#array_where)
    - [head](#head)
    - [last](#last)
- [Strings](#strings)
    - [ascii](#ascii)
    - [camel\_case](#camel_case)
    - [charsArray](#charsArray)
    - [ends\_with](#ends_with)
    - [preg\_replace\_sub](#preg_replace_sub)
    - [snake\_case](#snake_case)
    - [starts\_with](#starts_with)
    - [str\_contains](#str_contains)
    - [str\_finish](#str_finish)
    - [str\_is](#str_is)
    - [str\_limit](#str_limit)
    - [str\_random](#str_random)
    - [str\_replace\_array](#str_replace_array)
    - [str\_slug](#str_slug)
    - [studly\_case](#studly_case)
- [Classes](#classes)
    - [class\_basename](#class_basename)
    - [class\_uses\_recursive](#class_uses_recursive)
    - [trait\_uses\_recursive](#trait_uses_recursive)
- [Misc.](#misc)
    - [data\_get](#data_get)
    - [e](#e)
    - [object\_get](#object_get)
    - [value](#value)
    - [with](#with)

\## Arrays \### append\_config ```
/**
	 * Assign high numeric IDs to a config item to force appending.
	 *
	 * @param  array  $array
	 * @return array
*/
function append_config(array $array)
```

\### array\_add ```
/**
	 * Add an element to an array using "dot" notation if it doesn't exist.
	 *
	 * @param  array   $array
	 * @param  string  $key
	 * @param  mixed   $value
	 * @return array
*/
function array_add($array, $key, $value)
```

\### array\_build ```
/**
	 * Build a new array using a callback.
	 *
	 * @param  array     $array
	 * @param  \Closure  $callback
	 * @return array
*/
function array_build($array, Closure $callback)
```

\### array\_divide ```
/**
	 * Divide an array into two arrays. One with keys and the other with values.
	 *
	 * @param  array  $array
	 * @return array
*/
function array_divide($array)
```

\### array\_dot ```
/**
	 * Flatten a multi-dimensional associative array with dots.
	 *
	 * @param  array   $array
	 * @param  string  $prepend
	 * @return array
*/
function array_dot($array, $prepend = '')
```

\### array\_except ```
/**
	 * Get all of the given array except for a specified array of items.
	 *
	 * @param  array  $array
	 * @param  array|string  $keys
	 * @return array
*/
function array_except($array, $keys)
```

\### array\_fetch ```
/**
	 * Fetch a flattened array of a nested array element.
	 *
	 * @param  array   $array
	 * @param  string  $key
	 * @return array
*/
function array_fetch($array, $key)
```

\### array\_first ```
/**
	 * Return the first element in an array passing a given truth test.
	 *
	 * @param  array     $array
	 * @param  \Closure  $callback
	 * @param  mixed     $default
	 * @return mixed
*/
function array_first($array, $callback, $default = null)
```

\### array\_last ```
/**
	 * Return the last element in an array passing a given truth test.
	 *
	 * @param  array     $array
	 * @param  \Closure  $callback
	 * @param  mixed     $default
	 * @return mixed
*/
function array_last($array, $callback, $default = null)
```

\### array\_flatten ```
/**
	 * Flatten a multi-dimensional array into a single level.
	 *
	 * @param  array  $array
	 * @return array
*/
function array_flatten($array)
```

\### array\_forgot ```
/**
	 * Remove one or many array items from a given array using "dot" notation.
	 *
	 * @param  array  $array
	 * @param  array|string  $keys
	 * @return void
*/
function array_forget(&$array, $keys)
```

\### array\_get ```
/**
	 * Get an item from an array using "dot" notation.
	 *
	 * @param  array   $array
	 * @param  string  $key
	 * @param  mixed   $default
	 * @return mixed
*/
function array_get($array, $key, $default = null)
```

\### array\_has ```
/**
	 * Check if an item exists in an array using "dot" notation.
	 *
	 * @param  array   $array
	 * @param  string  $key
	 * @return bool
*/
function array_has($array, $key)
```

\### array\_only ```
/**
	 * Get a subset of the items from the given array.
	 *
	 * @param  array  $array
	 * @param  array|string  $keys
	 * @return array
*/
function array_only($array, $keys)
```

\### array\_pluck ```
/**
	 * Pluck an array of values from an array.
	 *
	 * @param  array   $array
	 * @param  string  $value
	 * @param  string  $key
	 * @return array
*/
function array_pluck($array, $value, $key = null)
```

\### array\_pull ```
/**
	 * Get a value from the array, and remove it.
	 *
	 * @param  array   $array
	 * @param  string  $key
	 * @param  mixed   $default
	 * @return mixed
*/
function array_pull(&$array, $key, $default = null)
```

\### array\_set ```
/**
	 * Set an array item to a given value using "dot" notation.
	 *
	 * If no key is given to the method, the entire array will be replaced.
	 *
	 * @param  array   $array
	 * @param  string  $key
	 * @param  mixed   $value
	 * @return array
*/
function array_set(&$array, $key, $value)
```

\### array\_where ```
/**
	 * Filter the array using the given Closure.
	 *
	 * @param  array     $array
	 * @param  \Closure  $callback
	 * @return array
*/
function array_where($array, Closure $callback)
```

\### head ```
/**
	 * Get the first element of an array. Useful for method chaining.
	 *
	 * @param  array  $array
	 * @return mixed
*/
function head($array)
```

\### last ```
/**
	 * Get the last element from an array.
	 *
	 * @param  array  $array
	 * @return mixed
*/
function last($array)
```

\## Strings \### ascii ```
/**
     * Transliterate a UTF-8 value to ASCII.
     *
     * @param  string  $value
     * @return string
 */
function ascii($value)
```

\### camel\_case ```
/**
	 * Convert a value to camel case.
	 *
	 * @param  string  $value
	 * @return string
*/
function camel_case($value)
```

\### charsArray ```
/**
     * Returns the replacements for the ascii method.
     *
     * Note: Adapted from Stringy\Stringy.
     *
     * @see https://github.com/danielstjules/Stringy/blob/2.3.1/LICENSE.txt
     *
     * @return array
 */
function charsArray()
```

\### ends\_with ```
/**
	 * Determine if a given string ends with a given substring.
	 *
	 * @param  string  $haystack
	 * @param  string|array  $needles
	 * @return bool
*/
function ends_with($haystack, $needles)
```

\### preg\_replace\_sub ```
/**
	 * Replace a given pattern with each value in the array in sequentially.
	 *
	 * @param  string  $pattern
	 * @param  array   $replacements
	 * @param  string  $subject
	 * @return string
*/
function preg_replace_sub($pattern, &$replacements, $subject)
```

\### snake\_case ```
/**
	 * Convert a string to snake case.
	 *
	 * @param  string  $value
	 * @param  string  $delimiter
	 * @return string
*/
function snake_case($value, $delimiter = '_')
```

\### starts\_with ```
/**
	 * Determine if a given string starts with a given substring.
	 *
	 * @param  string  $haystack
	 * @param  string|array  $needles
	 * @return bool
*/
function starts_with($haystack, $needles)
```

\### str\_contains ```
/**
	 * Determine if a given string contains a given substring.
	 *
	 * @param  string  $haystack
	 * @param  string|array  $needles
	 * @return bool
*/
function str_contains($haystack, $needles)
```

\### str\_finish ```
/**
	 * Cap a string with a single instance of a given value.
	 *
	 * @param  string  $value
	 * @param  string  $cap
	 * @return string
*/
function str_finish($value, $cap)
```

\### str\_is ```
/**
	 * Determine if a given string matches a given pattern.
	 *
	 * @param  string  $pattern
	 * @param  string  $value
	 * @return bool
*/
function str_is($pattern, $value)
```

\### str\_limit ```
/**
	 * Limit the number of characters in a string.
	 *
	 * @param  string  $value
	 * @param  int     $limit
	 * @param  string  $end
	 * @return string
*/
function str_limit($value, $limit = 100, $end = '...')
```

\### str\_random ```
/**
	 * Generate a more truly "random" alpha-numeric string.
	 *
	 * @param  int  $length
	 * @return string
	 *
	 * @throws \RuntimeException
*/
function str_random($length = 16)
```

\### str\_replace\_array ```
/**
	 * Replace a given value in the string sequentially with an array.
	 *
	 * @param  string  $search
	 * @param  array   $replace
	 * @param  string  $subject
	 * @return string
*/
function str_replace_array($search, array $replace, $subject)
```

\### str\_slug ```
/**
	 * Generate a URL friendly "slug" from a given string.
	 *
	 * @param  string  $title
	 * @param  string  $separator
	 * @return string
*/
function str_slug(string $title, string $separator = '-')
```

\### studly\_case ```
/**
	 * Convert a value to studly caps case.
	 *
	 * @param  string  $value
	 * @return string
*/
function studly_case($value)
```

\## Classes \### class\_basename ```
/**
	 * Get the class "basename" of the given object / class.
	 *
	 * @param  string|object  $class
	 * @return string
*/
function class_basename($class)
```

\### class\_uses\_recursive ```
/**
	 * Returns all traits used by a class, it's subclasses and trait of their traits
	 *
	 * @param  string  $class
	 * @return array
*/
function class_uses_recursive($class)
```

\### trait\_uses\_recursive ```
/**
	 * Returns all traits used by a trait and its traits
	 *
	 * @param  string  $trait
	 * @return array
*/
function trait_uses_recursive($trait)
```

\## Misc. \### data\_get ```
/**
	 * Get an item from an array or object using "dot" notation.
	 *
	 * @param  mixed   $target
	 * @param  string  $key
	 * @param  mixed   $default
	 * @return mixed
*/
function data_get($target, $key, $default = null)
```

\### e ```
/**
	 * Escape HTML entities in a string.
	 *
	 * @param  string  $value
	 * @return string
*/
function e($value)
```

\### object\_get ```
/**
	 * Get an item from an object using "dot" notation.
	 *
	 * @param  object  $object
	 * @param  string  $key
	 * @param  mixed   $default
	 * @return mixed
*/
function object_get($object, $key, $default = null)
```

\### value ```
/**
	 * Return the default value of the given value.
	 *
	 * @param  mixed  $value
	 * @return mixed
*/
function value($value)
```

\### with ```
/**
	 * Return the given object. Useful for chaining.
	 *
	 * @param  mixed  $object
	 * @return mixed
*/
function with($object)
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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

3540d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5398707?v=4)[Kun](/maintainers/kun391)[@kun391](https://github.com/kun391)

---

Top Contributors

[![rappasoft](https://avatars.githubusercontent.com/u/6026504?v=4)](https://github.com/rappasoft "rappasoft (12 commits)")[![brcontainer](https://avatars.githubusercontent.com/u/4368952?v=4)](https://github.com/brcontainer "brcontainer (1 commits)")[![ericjeker](https://avatars.githubusercontent.com/u/979397?v=4)](https://github.com/ericjeker "ericjeker (1 commits)")[![kun391](https://avatars.githubusercontent.com/u/5398707?v=4)](https://github.com/kun391 "kun391 (1 commits)")

---

Tags

laravelhelpers

### Embed Badge

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

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

###  Alternatives

[rappasoft/laravel-helpers

Laravel Helpers for Non-Laravel Projects

277673.0k22](/packages/rappasoft-laravel-helpers)[devmarketer/easynav

Making managing navigation in Laravel easy.

105157.8k](/packages/devmarketer-easynav)[transprime-research/piper

PHP Pipe method execution with values from chained method executions

174.6k2](/packages/transprime-research-piper)

PHPackages © 2026

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