PHPackages                             michaeljennings/utilities - 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. michaeljennings/utilities

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

michaeljennings/utilities
=========================

v1.2.3(6y ago)04.4kMITPHPPHP &gt;=7.1.3

Since Jul 17Pushed 6y ago1 watchersCompare

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

READMEChangelog (9)Dependencies (5)Versions (10)Used By (0)

Utilities
=========

[](#utilities)

This package contains a series of utility classes that I use frequently in projects, most of the utilities are built with laravel in mind.

### Installation

[](#installation)

Install using `composer require michaeljennings/utilities`.

### Refinery Caching

[](#refinery-caching)

Occasionally when using the [refinery](https://github.com/michaeljennings/refinery) package you may have templates that are quite intensive to run.

To fix this you can use the `CachesTemplates` trait.

Firstly, you need to install the [michaeljennings/broker](https://github.com/michaeljennings/broker) package.

Then on the class you want to refine implement the `Cacheable` interface. See the broker documentation for more information.

```
// Item being refined
class ToRefine implements Michaeljennings\Broker\Contracts\Cacheable
{
    /**
     * Get the key to cache the attributes against.
     *
     * @return string
     */
    public function getCacheKey()
    {
        return 'test';
    }

    /**
     * Get the unique key for the cacheable item.
     *
     * @return int|string
     */
    public function getKey()
    {
        return 1;
    }
}
```

Finally implement the `CachesTemplates` trait on your refinery.

```
class Example extends Michaeljennings\Refinery\Refinery
{
    use CachesTemplates;

    public function setTemplate($item)
    {
        //
    }
}
```

### Domain Builder

[](#domain-builder)

Very frequently I build projects that use multiple subdomains. I also find I need to create links between subdomains quite frequently but I don't want to hard code the links.

This class allows you to create links between multiple domains, but use the same API throughout your application.

Firstly you need to define the domains in the `utilities.php` config file.

```
'domains' => [
  'app' => 'http://app.example.com',
  'api' => 'http://api.example.com',
]
```

Then you can either hit the `get` method, or dynamically hit the key you have set.

```
$url = $domainBuilder->get('app'); // http://app.example.com
$url = $domainBuilder->app(); // http://app.example.com
```

You can also pass anything you want to be appended to the url as an argument.

```
$url = $domainBuilder->get('app', 'foo/bar'); // http://app.example.com/foo/bar
$url = $domainBuilder->get('app', 'foo', 'bar'); // http://app.example.com/foo/bar
$url = $domainBuilder->app('foo/bar'); // http://app.example.com/foo/bar
$url = $domainBuilder->app('foo', 'bar'); // http://app.example.com/foo/bar
```

I usually resolve class using laravel's IOC container, but if you want to new it up yourself you just need to pass the config to the constructor.

```
$domainBuilder = new MichaelJennings\Utilities\DomainBuilder(config('utilities.domains'));
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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 ~71 days

Recently: every ~55 days

Total

9

Last Release

2289d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/df807d0371b1b265ea1becedfa4001428f278e7632c6d175e2afb2921f5788a3?d=identicon)[michaeljennings](/maintainers/michaeljennings)

---

Top Contributors

[![michaeljennings](https://avatars.githubusercontent.com/u/5189701?v=4)](https://github.com/michaeljennings "michaeljennings (24 commits)")

### Embed Badge

![Health badge](/badges/michaeljennings-utilities/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

20917.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9346.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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