PHPackages                             gulfaraz-arshad/laravel-arr-extended - 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. gulfaraz-arshad/laravel-arr-extended

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

gulfaraz-arshad/laravel-arr-extended
====================================

Extended Arr helpers for Laravel including Arr::after()

v1.0.0(2mo ago)02MITPHP

Since May 12Pushed 2mo agoCompare

[ Source](https://github.com/gulfaraz-arshad/laravel-arr-extended)[ Packagist](https://packagist.org/packages/gulfaraz-arshad/laravel-arr-extended)[ RSS](/packages/gulfaraz-arshad-laravel-arr-extended/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Laravel Arr Extended
====================

[](#laravel-arr-extended)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9ae217be660b9c666f31400dfaee7c3eaacdf1809834a695fbed7941074815e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67756c666172617a2d6172736861642f6c61726176656c2d6172722d657874656e6465642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gulfaraz-arshad/laravel-arr-extended)[![Total Downloads](https://camo.githubusercontent.com/ae5ab33b239d62d9e5cf2b2761df57a6ac51e2dad45afb66604cb4d327c7e7ce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67756c666172617a2d6172736861642f6c61726176656c2d6172722d657874656e6465642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gulfaraz-arshad/laravel-arr-extended)[![License](https://camo.githubusercontent.com/0dd35c240c0c4b74f1269051798db9e843c053e16c8c5b29fc4911f4efae79b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f67756c666172617a2d6172736861642f6c61726176656c2d6172722d657874656e6465642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gulfaraz-arshad/laravel-arr-extended)

Extended Arr helpers for Laravel — filling the small gaps that Laravel's built-in `Arr` class doesn't cover.

Why This Package?
-----------------

[](#why-this-package)

Laravel's `Arr` class provides helpful methods like `Arr::first()` and `Arr::last()` — but there's no clean way to get the value *after* a given value in an array. This package fills that gap.

> I originally submitted this as a PR to the Laravel framework. Taylor decided to keep the framework minimal, so I released it as a standalone package instead.

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 11.x or 12.x

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

[](#installation)

```
composer require gulfaraz-arshad/laravel-arr-extended
```

Available Methods
-----------------

[](#available-methods)

### `Arr::after()`

[](#arrafter)

Retrieves the value after a given value in an array.

```
use GulfarazArshad\LaravelArrExtended\Arr;

Arr::after(array $array, mixed $value, bool $wrap = false): mixed
```

#### Basic Usage

[](#basic-usage)

```
// Returns the value after 'a'
Arr::after(['a', 'b', 'c'], 'a'); // 'b'

// Last element returns null by default
Arr::after(['a', 'b', 'c'], 'c'); // null

// Value not found returns null
Arr::after(['a', 'b', 'c'], 'z'); // null

// Empty array returns null
Arr::after([], 'a'); // null
```

#### With `wrap` Flag

[](#with-wrap-flag)

```
// Last element wraps to first
Arr::after(['a', 'b', 'c'], 'c', wrap: true); // 'a'

// Value not found with wrap returns first element
Arr::after(['a', 'b', 'c'], 'z', wrap: true); // 'a'
```

#### Associative Arrays

[](#associative-arrays)

```
// Works with associative arrays
Arr::after(['x' => 'a', 'y' => 'b'], 'a'); // 'b'
```

#### Type Safety

[](#type-safety)

```
// Strict comparison — no type juggling
Arr::after([1, 2, 3], '1'); // null (string !== integer)
Arr::after([1, 2, 3], 1);   // 2 ✅
```

Real World Examples
-------------------

[](#real-world-examples)

**Step wizard:**

```
$steps = ['personal', 'address', 'payment', 'confirm'];

$next = Arr::after($steps, 'payment'); // 'confirm'
$done = Arr::after($steps, 'confirm'); // null — wizard complete!
```

**Carousel navigation:**

```
$slides = ['home', 'about', 'contact'];

$next = Arr::after($slides, 'contact', wrap: true); // 'home'
```

**Round-robin load balancing:**

```
$servers = ['server1', 'server2', 'server3'];

$next = Arr::after($servers, 'server3', wrap: true); // 'server1'
```

**Day of week rotation:**

```
$days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];

$next = Arr::after($days, 'Sun', wrap: true); // 'Mon'
```

Testing
-------

[](#testing)

```
./vendor/bin/phpunit
```

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

[](#contributing)

Contributions are welcome! If you have ideas for other array helpers that are missing from Laravel, feel free to open an issue or submit a PR.

Credits
-------

[](#credits)

- [Gulfaraz Arshad](https://github.com/gulfaraz-arshad)
- [Original Laravel PR #60081](https://github.com/laravel/framework/pull/60081)

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance86

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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

73d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c5a03e6761ea05b845d1b3b30b6d2ba616eaac9c67b0595764640c205fa136c?d=identicon)[gul-Faraz](/maintainers/gul-Faraz)

---

Top Contributors

[![gulfaraz-arshad](https://avatars.githubusercontent.com/u/126146160?v=4)](https://github.com/gulfaraz-arshad "gulfaraz-arshad (4 commits)")[![gulfarazarshad](https://avatars.githubusercontent.com/u/134137781?v=4)](https://github.com/gulfarazarshad "gulfarazarshad (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gulfaraz-arshad-laravel-arr-extended/health.svg)

```
[![Health](https://phpackages.com/badges/gulfaraz-arshad-laravel-arr-extended/health.svg)](https://phpackages.com/packages/gulfaraz-arshad-laravel-arr-extended)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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