PHPackages                             glhd/quartermaster - 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. glhd/quartermaster

ActiveLibrary

glhd/quartermaster
==================

00PHP

Since Sep 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/glhd/quartermaster)[ Packagist](https://packagist.org/packages/glhd/quartermaster)[ RSS](/packages/glhd-quartermaster/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

 [ ![Build Status](https://github.com/glhd/quartermaster/workflows/PHPUnit/badge.svg) ](https://github.com/glhd/quartermaster/actions) [ ![Coverage Status](https://camo.githubusercontent.com/a54ade6b604707212d0bcdd563c2e0d7fad8c9b487076db61a32edbc4eb05d82/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f34356162396564343630363832656232346262362f746573745f636f766572616765) ](https://codeclimate.com/github/glhd/quartermaster/test_coverage) [ ![Latest Stable Release](https://camo.githubusercontent.com/0765165e0ac260616bd3d1f480de69120d71e6d3eb2040b4148f07c204d44bf0/68747470733a2f2f706f7365722e707567782e6f72672f676c68642f717561727465726d61737465722f762f737461626c65) ](https://packagist.org/packages/glhd/quartermaster) [ ![MIT Licensed](https://camo.githubusercontent.com/2e23d1a65c555c408a0dc1fb1edb37ec5d0638c4c74c094d956b75ee0c44df9d/68747470733a2f2f706f7365722e707567782e6f72672f676c68642f717561727465726d61737465722f6c6963656e7365) ](./LICENSE) [ ![Follow @inxilpro on Twitter](https://camo.githubusercontent.com/e6d0a3893c652423c3a7c6aa648ca6e98a3b06899551e17a2fe5b33528244dcb/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f696e78696c70726f3f7374796c653d736f6369616c) ](https://twitter.com/inxilpro)

Quartermaster
=============

[](#quartermaster)

Quartermaster makes it easy to use [PHP enums](https://www.php.net/manual/en/language.types.enumerations.php)with [Laravel Pennant](https://laravel.com/docs/11.x/pennant).

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

[](#installation)

```
composer require glhd/quartermaster
```

Usage
-----

[](#usage)

Add the `EnumeratesFeatures` trait to any enum to use it with Pennant:

```
enum BillingFeatures
{
    use EnumeratesFeatures;

    case NextGenerationPortal;
    case LegacyPortal;

    // Define a "resolver" for each feature:

    public function resolveNextGenerationPortal(Team $team)
    {
        return $team->owner->isEnrolledInBetaFeatures();
    }

    public function resolveLegacyPortal(Team $team)
    {
        return $team->created_at->lt('2022-06-01');
    }
}
```

Next, register your enum with Pennant:

```
// in a service provider's boot method:
BillingFeatures::register();
```

Then, you can call many Pennant methods from the enum directly:

```
if (BillingFeatures::NextGenerationPortal->active()) {
    // Show next-gen billing portal
}

if (BillingFeatures::NextGenerationPortal->inactive()) {
    // Show opt-in for beta features
}
```

For many checks, you may need a scope. You can use the `for()` method on the enum to do scoped checks:

```
if (BillingFeatures::LegacyPortal->for($team)->active()) {
    // Show legacy billing portal
}

// Enable next-gen portal for team
BillingFeatures::NextGenerationPortal->for($team)->activate();

// Disable next-gen portal for team
BillingFeatures::NextGenerationPortal->for($team)->deactivate();

// Reset flag status for team
BillingFeatures::NextGenerationPortal->for($team)->forget();
```

### Using with class-based features

[](#using-with-class-based-features)

Pennant already offers [class-based features](https://laravel.com/docs/11.x/pennant#class-based-features). If you would like to use some of the Quartermaster convenience methods with this API, you can extend the `Glhd\Quartermaster\Feature` class:

```
namespace App\Features;

use Glhd\Quartermaster\Feature;

class NextGenerationBillingPortal extends Feature
{
    public function resolve(Team $team)
    {
        return $team->owner->isEnrolledInBetaFeatures();
    }
}
```

Then you can call most of the same methods statically from this class:

```
if (NextGenerationBillingPortal::active()) {
    // Show next-gen portal
}

if (NextGenerationBillingPortal::for($team)->active()) {
    // ...
}
```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 Bus Factor1

Top contributor holds 85.7% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/21592?v=4)[Chris Morrell](/maintainers/inxilpro)[@inxilpro](https://github.com/inxilpro)

---

Top Contributors

[![inxilpro](https://avatars.githubusercontent.com/u/21592?v=4)](https://github.com/inxilpro "inxilpro (6 commits)")[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (1 commits)")

---

Tags

feature-flagslaravelpennant

### Embed Badge

![Health badge](/badges/glhd-quartermaster/health.svg)

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

PHPackages © 2026

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