Skip to content

Instantly share code, notes, and snippets.


Simon Kollross skollro

View GitHub Profile
View Temporary.php
class Temporary
public static function file($contents, $callback)
$path = tempnam(sys_get_temp_dir(), 'php_');
file_put_contents($path, $contents);
try {
View FakeSoapClient.php
class FakeSoapClient extends \SoapClient
protected $response;
protected $customizer;
public static function wsdl($wsdl)
return new self($wsdl);
View Match.php
class Match
protected $value;
protected $result;
protected $hasMatch;
public function __construct($value)
skollro / join.php
Last active Apr 29, 2017
A join collection macro
View join.php
Collection::macro('join', function ($items, callable $callback) {
return $this->flatMap(function ($value) use ($items, $callback) {
return $items->filter(function ($item) use ($value, $callback) {
return $callback($value, $item);
})->map(function ($item) use ($value) {
return new Collection([$value, $item]);