PHPackages                             josephlavin/tap - 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. josephlavin/tap

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

josephlavin/tap
===============

Stand alone port of Laravel's tap method.

v1.0.0(8y ago)220.6k↓50%MITPHPPHP &gt;=5.6.0

Since Sep 25Pushed 8y ago2 watchersCompare

[ Source](https://github.com/josephlavin/tap)[ Packagist](https://packagist.org/packages/josephlavin/tap)[ RSS](/packages/josephlavin-tap/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

josephlavin/tap
===============

[](#josephlavintap)

[![Build Status](https://camo.githubusercontent.com/2febd4f983fcaa24362927ee1cb61556de0ea894c378e18e60a221ab5b7d8415/68747470733a2f2f7472617669732d63692e6f72672f6a6f736570686c6176696e2f7461702e737667)](https://travis-ci.org/josephlavin/tap)

A stand alone port of [Laravel's](https://laravel.com/) `tap` method (inspired by Ruby). This package will add a `tap` method to the global namespace. For more information see [Taylor Otwell's explanation of tap](https://medium.com/@taylorotwell/tap-tap-tap-1fc6fc1f93a6).

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

[](#installation)

```
composer require josephlavin/tap
```

Example
-------

[](#example)

You need to create a model and commit it to the database using `save`:

```
function createAndSaveModel($attributes)
{
    $model = new Model($attributes);

    $model->save();

    return $model;
}
```

The same code can be simplified utilizing `tap`:

```
function createAndSaveModel($attributes)
{
    return tap(new Model($attributes), function (Model $model) {
        $model->save();
    });
}
```

Utilizing the proxy feature it can be further simplified:

```
function createAndSaveModel($attributes)
{
    return tap(new Model($attributes))->save();
}
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3158d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/65083113296bd07585eeede4839f41d311366c6abe8a47039ebca7f07526d968?d=identicon)[josephlavin](/maintainers/josephlavin)

---

Top Contributors

[![josephlavin](https://avatars.githubusercontent.com/u/7443997?v=4)](https://github.com/josephlavin "josephlavin (7 commits)")

---

Tags

laravelphpphp7phplaraveltap

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/josephlavin-tap/health.svg)

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

###  Alternatives

[amranidev/laracombee

Recommendation system for laravel

11636.7k1](/packages/amranidev-laracombee)[salmanzafar/laravel-geocode

A Laravel Library to find Lat and Long of a given Specific Address

153.9k](/packages/salmanzafar-laravel-geocode)[wujunze/money-wrapper

MoneyPHP Wrapper

113.8k](/packages/wujunze-money-wrapper)

PHPackages © 2026

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