2017 © Pedro Peláez
 

project tap

image

benjy/tap

  • Wednesday, August 16, 2017
  • by benjy
  • Repository
  • 1 Watchers
  • 4 Stars
  • 1,139 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 19 % Grown

The README.md

Installation

composer require benjy/tap

Usage

Without a callback:, (*1)

$person = new Person();
tap($person)
    ->update(['name' => 'Ben'])
    ->save();

With a callback:, (*2)

$person = new Person();
tap($person, function ($person) {
    $person->update(['name' => 'Ben'])
    $person->save();
});

Way more useful examples here: https://mattstauffer.co/blog/introducing-laravels-tap-higher-order-tap-and-collection-tap, (*3)

Credits

The original concept for this method comes from Ruby. https://ruby-doc.org/core-2.2.3/Object.html#method-i-tap, (*4)

This code was taken straight from the Laravel framework where I initially discovered this concept. I wanted to use it in other applications so I broke it out into a separate library. Thanks to Laravel, (*5)

License

This library is open-sourced software licensed under the MIT license., (*6)

The Versions

16/08 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Development Requires

16/08 2017

0.0.1

0.0.1.0

  Sources   Download

MIT

The Development Requires