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

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

sven/helpers
============

A collection of useful helper functions for in Laravel applications.

v1.2.0(8y ago)2013MITPHPPHP ^7.0

Since Feb 25Pushed 8y ago2 watchersCompare

[ Source](https://github.com/svenluijten/helpers)[ Packagist](https://packagist.org/packages/sven/helpers)[ RSS](/packages/sven-helpers/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (3)Versions (7)Used By (0)

[![helpers](https://cloud.githubusercontent.com/assets/11269635/23331282/fc1f9b66-fb62-11e6-953d-19d813ea39ef.jpg)](https://cloud.githubusercontent.com/assets/11269635/23331282/fc1f9b66-fb62-11e6-953d-19d813ea39ef.jpg)

Helpers
=======

[](#helpers)

[![Latest Version on Packagist](https://camo.githubusercontent.com/475bc43f1d4b30b6481f4c0549082030ee50fa8d8e4b50727e28bedee01a7733/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7376656e2f68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sven/helpers)[![Total Downloads](https://camo.githubusercontent.com/88d728b78d28ec55e21f5c020b6717de897de92a26c445eacd6114fa84a434a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7376656e2f68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sven/helpers)[![Software License](https://camo.githubusercontent.com/6c711032aff1ca0eb6b211aa6cb3649ce7fd64a7714e1181d4bb457f9680e7cf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/1cb46ca901d178b2d133711a19fffb14c0b0ae7b36de732079aa9d039c21487d/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f70726f6a6563742f6769746875622f7376656e6c75696a74656e2f68656c706572732e7376673f7374796c653d666c61742d737175617265)](https://circleci.com/gh/svenluijten/helpers)[![StyleCI](https://camo.githubusercontent.com/4a89490b915f8082d7829c577856446d41682b6e17e34de877a8fe5a01b69c0d/68747470733a2f2f7374796c6563692e696f2f7265706f732f38333133323036392f736869656c64)](https://styleci.io/repos/83132069)

This is a collection of useful helpers for use in Laravel applications. Mainly made for personal use, but if you find (some of) the helpers useful, feel free to use it!

Installation
------------

[](#installation)

Via [composer](http://getcomposer.org):

```
$ composer require sven/helpers
```

Or add the package to your dependencies in `composer.json` and run `composer install` on the command line to download the package:

```
{
    "require": {
        "sven/helpers": "^1.0"
    }
}
```

Available functions
-------------------

[](#available-functions)

All available functions are listed here, along with their usage and an example on how I would use them.

### active\_route

[](#active_route)

This function will return `true` if you're on the given route name, `false` otherwise:

```
$isHome = active_route('home');
```

You may also pass in optional `$positive` or `$negative` values to return:

```
$isContact = active_route('contact', 'Yes!', 'No :(');
```

There is also an option to give it an array of multiple route names instead of just one. The function will return `$positive` if the current route matches any of the given ones, `$negative` otherwise:

```
$isContactOrAbout = active_route(['contact', 'about']);
```

`active_route()` can be tremendously useful for `active` states on for instance navigation in blade templates:

```

            Home

            Contact

            About

```

### str\_possessive

[](#str_possessive)

This function will return the possessive form of a subject string you give it:

```
echo str_possessive('Brian') . ' house.'; // "Brian's house."
```

It will only append an apostrophe (without the trailing `s`) if the given subject ends in `s`, `z` or `ch`:

```
echo str_possessive('Dolores') . ' eyes.'; // "Dolores' eyes."
echo str_possessive('Sanchez') . ' shoes.'; // "Sanchez' shoes."
echo str_possessive('Gretch') . ' plate.'; // "Gretch' plate."
```

### pipe

[](#pipe)

The `pipe()` function will simply return an instance of the `\Illuminate\Pipeline\Pipeline`class from Laravel's container, which allows for some neat chaining:

```
echo pipe('hello')->through([
    AddComma::class,
    AddWorld::class,
])->then(function ($content) {
    return $content;
}); // This will output "hello, world!"

// AddComma class:
class AddComma
{
    public function handle($string, Closure $next)
    {
        return $next($string . ',');
    }
}

// AddWorld class:
class AddWorld
{
    public function handle($string, Closure $next)
    {
        return $next($string . ' world!');
    }
}
```

Contributing
------------

[](#contributing)

All contributions (pull requests, issues and feature requests) are welcome. Make sure to read through the [CONTRIBUTING.md](CONTRIBUTING.md) first, though. See the [contributors page](../../graphs/contributors) for all contributors.

License
-------

[](#license)

`sven/helpers` is licensed under the MIT License (MIT). Please see the [license file](LICENSE.md) for more information.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 96.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 ~64 days

Recently: every ~77 days

Total

6

Last Release

3088d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6682e025b83b7a93b4d43c5c9b0b2245d790d72352758c47b81ba14858f45a8a?d=identicon)[svenluijten](/maintainers/svenluijten)

---

Top Contributors

[![svenluijten](https://avatars.githubusercontent.com/u/11269635?v=4)](https://github.com/svenluijten "svenluijten (31 commits)")[![ConnorVG](https://avatars.githubusercontent.com/u/3260091?v=4)](https://github.com/ConnorVG "ConnorVG (1 commits)")

---

Tags

helperslaravellaravel-5-packagepackagehelpersdevelopmentfunctionsuseful

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[illuminated/helper-functions

Laravel-specific and pure PHP Helper Functions.

107591.1k7](/packages/illuminated-helper-functions)

PHPackages © 2026

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