PHPackages                             chipslays/sauce - 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. chipslays/sauce

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

chipslays/sauce
===============

Collection of Simple Traits.

1.0.1(4y ago)061513MITPHP

Since Apr 25Pushed 4y ago1 watchersCompare

[ Source](https://github.com/chipslays/sauce)[ Packagist](https://packagist.org/packages/chipslays/sauce)[ RSS](/packages/chipslays-sauce/feed)WikiDiscussions master Synced 1w ago

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

🍅 Sauce
=======

[](#-sauce)

[![Tests](https://github.com/chipslays/sauce/actions/workflows/tests.yml/badge.svg)](https://github.com/chipslays/sauce/actions/workflows/tests.yml)[![Packagist Version](https://camo.githubusercontent.com/3853062ef6f5b02fbee27fb0928baf3988a9398c631e446e6d344e5e1c855109/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63686970736c6179732f7361756365)](https://camo.githubusercontent.com/3853062ef6f5b02fbee27fb0928baf3988a9398c631e446e6d344e5e1c855109/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63686970736c6179732f7361756365)[![GitHub](https://camo.githubusercontent.com/d08c8d41b97d26b864ae092aef83811f75aa57783b16ed4926b9e4fcdf8ae2b0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f63686970736c6179732f7361756365)](https://camo.githubusercontent.com/d08c8d41b97d26b864ae092aef83811f75aa57783b16ed4926b9e4fcdf8ae2b0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f63686970736c6179732f7361756365)

A sauce made from useful things.

Installation
============

[](#installation)

```
$ composer require chipslays/sauce
```

Usage
=====

[](#usage)

Singleton
---------

[](#singleton)

A simple implementation of a Singleton as a trait.

```
use Sauce\Traits\Singleton;

class Hero
{
    use Singleton;
}

$hero1 = Hero::getInstance();
$hero1->attack();

Hero::forgetInstance();
$hero2 = Hero::getInstance();
$hero2->attack();
```

```
use Sauce\Traits\Singleton;

class SingletonClass {
    use Singleton;

    private $value;

    /**
     * @param mixed $value
     * @return static
     */
    public function set($value)
    {
        $this->value = $value;
        return $this;
    }

    /**
     * @return mixed
     */
    public function get()
    {
        return $this->value;
    }
}

echo SingletonClass::getInstance()->set(1)->get(); // return 2
echo SingletonClass::getInstance()->set(2)->get(); // return 2

SingletonClass::forgetInstance();
echo SingletonClass::getInstance()->set(3)->get(); // return 3
```

Mappable
--------

[](#mappable)

When applied to a class, makes it possible to add methods to that class at runtime.

> ℹ `Mappable` already include `Call` trait.

```
use Sauce\Traits\MappableClass;

class MappableClass {
    use Mappable;
}

$class = new MappableClass;
$class->map('sum', fn(...$args) => array_sum($args));
echo $class->sum(1000, 300, 30, 5, 2) // 1337

$class::mapOnce('timestamp', fn() => time());
echo $class->timestamp(); // e.g. 1234567890
echo $class->timestamp(); // e.g. 1234567890
```

```
use Sauce\Traits\MappableClass;

class MappableClass {
    use Mappable;
}

MappableClass::map('sum', fn(...$args) => array_sum($args));
echo MappableClass::sum(1000, 300, 30, 5, 2)

MappableClass::mapOnce('timestamp', fn() => time());
echo MappableClass::timestamp()
```

Call
----

[](#call)

Call function or static/non-static classes.

```
use Sauce\Traits\Call;

class MyClass {
    use Call;
}

$class = new MyClass;
$class->__call_function(fn () => true);
$class->__call_function('\App\Controllers\MainController@home');
$class->__call_function('\App\Controllers\MainController@users', [$id]);
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity53

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

Every ~332 days

Total

2

Last Release

1518d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19103498?v=4)[chipslays](/maintainers/chipslays)[@chipslays](https://github.com/chipslays)

---

Top Contributors

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

---

Tags

collectiontraitscollectiontraits

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chipslays-sauce/health.svg)

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

###  Alternatives

[phpcollection/phpcollection

General-Purpose Collection Library for PHP

1.0k64.0M34](/packages/phpcollection-phpcollection)[aimeos/map

Easy and elegant handling of PHP arrays as array-like collection objects similar to jQuery and Laravel Collections

4.2k412.9k11](/packages/aimeos-map)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[loophp/collection

A (memory) friendly, easy, lazy and modular collection class.

745663.8k13](/packages/loophp-collection)[athari/yalinqo

YaLinqo, a LINQ-to-objects library for PHP

4561.2M5](/packages/athari-yalinqo)[lorisleiva/lody

Load files and classes as lazy collections in Laravel.

956.6M9](/packages/lorisleiva-lody)

PHPackages © 2026

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