PHPackages                             offload-project/laravel-hoist - 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. offload-project/laravel-hoist

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

offload-project/laravel-hoist
=============================

Feature discovery and util extension for Laravel Pennant

v1.4.0(2w ago)4541MITPHPPHP ^8.3CI passing

Since Dec 16Pushed 2w agoCompare

[ Source](https://github.com/offload-project/laravel-hoist)[ Packagist](https://packagist.org/packages/offload-project/laravel-hoist)[ RSS](/packages/offload-project-laravel-hoist/feed)WikiDiscussions main Synced today

READMEChangelog (6)Dependencies (28)Versions (14)Used By (0)

Laravel Hoist
=============

[](#laravel-hoist)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2d9660e253f557ea800f4243fcf95150a4b4881d41096cf693907ba95027f08e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f66666c6f61642d70726f6a6563742f6c61726176656c2d686f6973742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/offload-project/laravel-hoist)[![Tests](https://camo.githubusercontent.com/9244af54478d342ff9b4d4ced22a7b5d26d82ccb8627ca70bce5de2aea6e6709/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f66666c6f61642d70726f6a6563742f6c61726176656c2d686f6973742f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/offload-project/laravel-hoist/actions/workflows/tests.yml)[![Build](https://camo.githubusercontent.com/4270e21d28bbd5f9eece8ed3584f77f04c98e9ecc1e665de8d4937f3ace27219/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f66666c6f61642d70726f6a6563742f6c61726176656c2d686f6973742f72656c656173652e796d6c3f6c6162656c3d6275696c64267374796c653d666c61742d737175617265)](https://github.com/offload-project/laravel-hoist/actions/workflows/release.yml)[![Total Downloads](https://camo.githubusercontent.com/32f25df8a75385f593fa7f6100242ed96eb61bd159aaa9aa470be264a6fb786b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f66666c6f61642d70726f6a6563742f6c61726176656c2d686f6973742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/offload-project/laravel-hoist)[![License: MIT](https://camo.githubusercontent.com/6c711032aff1ca0eb6b211aa6cb3649ce7fd64a7714e1181d4bb457f9680e7cf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

Feature discovery and management extension for Laravel Pennant. Automatically discover, manage, and serve feature flags with custom metadata, tags, and routing.

Features
--------

[](#features)

- **Automatic discovery** — Drop a class into your `Features` directory; it's picked up without manual registration
- **PHP attributes** — Declarative metadata via `#[Label]`, `#[Description]`, `#[Route]`, `#[Tags]`, `#[FeatureSet]`
- **Rich `FeatureData` payload** — Structured DTO with label, description, href, active status, tags, and metadata
- **Per-user resolution** — `Hoist::forModel($user)` returns every feature with its active status for that scope
- **Tag-based filtering** — Filter features by single tag, ALL tags (AND), or ANY tag (OR)
- **Feature sets** — Group related features under a named set
- **Route integration** — Generate an `href` from a named route, safely handling missing routes
- **Pennant compatible** — Works alongside Pennant's native `Feature::active()`, `@feature` Blade directive, and middleware
- **Customizable stubs** — Publish and customize the `hoist:feature` generator template

Table of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Quick Start](#quick-start)
    - [Create a Feature](#1-create-a-feature)
    - [Use Features](#2-use-features)
    - [Filter by Tags](#3-filter-by-tags)
- [Attributes](#attributes)
- [Feature Discovery Service](#feature-discovery-service)
- [Feature Data Structure](#feature-data-structure)
- [Integration with Laravel Pennant](#integration-with-laravel-pennant)
- [Use Cases](#use-cases)
- [Advanced Usage](#advanced-usage)
- [AI Coding Assistant Skill](#ai-coding-assistant-skill)
- [Testing](#testing)
- [Contributing](#contributing)
- [Security](#security)
- [License](#license)

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 11/12/13
- Laravel Pennant 1+

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

[](#installation)

```
composer require offload-project/laravel-hoist
```

Configuration
-------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=hoist-config
```

Edit `config/hoist.php`:

```
return [
    'feature_directories' => [
        app_path('Features') => 'App\\Features',
    ],
];
```

The configuration uses an associative array where keys are directory paths and values are their corresponding namespaces.

Optionally, publish the stub files for customization:

```
php artisan vendor:publish --tag=hoist-stubs
```

Quick Start
-----------

[](#quick-start)

### 1. Create a Feature

[](#1-create-a-feature)

```
php artisan hoist:feature BillingFeature
```

This creates a new feature class in your configured feature directory (default: `app/Features`).

Features can define metadata using **PHP attributes** (recommended) or **class properties**. Attributes take precedence over properties when both are present.

```
