PHPackages                             quellabs/discover - 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. quellabs/discover

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

quellabs/discover
=================

Service discovery component for the Quellabs ecosystem

1.0.45(1mo ago)04095MITPHP

Since Jun 3Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/quellabs/discover)[ Packagist](https://packagist.org/packages/quellabs/discover)[ RSS](/packages/quellabs-discover/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (20)Versions (35)Used By (5)

Quellabs Discover
=================

[](#quellabs-discover)

[![PHP Version](https://camo.githubusercontent.com/412aeaf31cf844b15229e8adf376619d842a0a58b427f5ee2e57e2878f1ce62a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7175656c6c6162732f646973636f7665722e737667)](https://packagist.org/packages/quellabs/discover)[![Latest Version on Packagist](https://camo.githubusercontent.com/b71722066f311a08bbfc686a8c96411d00a28d1bb614574dd920b459a23e0862/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7175656c6c6162732f646973636f7665722e737667)](https://packagist.org/packages/quellabs/discover)[![License](https://camo.githubusercontent.com/de5817167b8d2b77fba513aaface2d16e8d0f371d347673b61fbe3372b728af0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7175656c6c6162732f646973636f7665722e737667)](https://github.com/quellabs/discover/blob/master/LICENSE.md)

A lightweight, flexible service discovery component for PHP applications that automatically discovers service providers across your application and its dependencies with advanced caching and lazy loading capabilities.

Introduction
------------

[](#introduction)

Quellabs Discover solves the common challenge of service discovery in PHP applications. It focuses solely on locating service providers defined in your application and its dependencies, giving you complete control over how to use these providers in your application architecture. Unlike other service discovery solutions that force specific patterns, Discover is framework-agnostic and can be integrated into any PHP application.

**Key Features:**

- **Framework Agnostic**: Works with any PHP application or framework
- **Multiple Discovery Methods**: Composer configuration, directory scanning, and custom scanners
- **Provider Families**: Organize providers into logical groups
- **Fluent Query Builder**: Chainable API for filtering providers
- **Efficient Discovery**: Uses static methods to gather metadata without instantiation
- **Efficient Caching**: Export and import provider definitions for fast subsequent loads
- **Lazy Instantiation**: Providers are only created when actually needed

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

[](#installation)

Install the package via Composer:

```
composer require quellabs/discover
```

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

[](#quick-start)

Here's how to quickly get started with Discover:

```
use Quellabs\Discover\Discover;
use Quellabs\Discover\Scanner\ComposerScanner;
use Quellabs\Discover\Scanner\DirectoryScanner;

// Create a Discover instance
$discover = new Discover();

// Configure scanners to discover providers
$discover->addScanner(new ComposerScanner());
$discover->addScanner(new DirectoryScanner([
    __DIR__ . '/app/Providers'
], '/Provider$/'));

// Run the discovery process (gathers metadata without instantiation)
$discover->discover();

// Use the fluent query builder to find specific providers
$cacheProviders = $discover->findProviders()
    ->withCapability('redis')
    ->withMinPriority(5)
    ->get();

foreach ($cacheProviders as $provider) {
    // Register with your container or use directly
    $yourContainer->register($provider);
}
```

Service Providers
-----------------

[](#service-providers)

### Creating a Service Provider

[](#creating-a-service-provider)

To create a discoverable service provider, implement the `ProviderInterface`:

```
