PHPackages                             myerscode/package-discovery - 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. myerscode/package-discovery

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

myerscode/package-discovery
===========================

A package to help find plugins for your product through Composer meta data!

2026.0.0(2mo ago)2630[2 PRs](https://github.com/myerscode/package-discovery/pulls)MITPHPPHP ^8.5CI passing

Since Sep 25Pushed 2w ago1 watchersCompare

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

READMEChangelog (1)Dependencies (8)Versions (8)Used By (0)

Package Discovery
=================

[](#package-discovery)

> A service to help easily find plugins for your services, using Composer metadata!

[![Latest Stable Version](https://camo.githubusercontent.com/011f52eb5808556384b437902fd105c141950998cf5d815d03b1977021866141/68747470733a2f2f706f7365722e707567782e6f72672f6d79657273636f64652f7061636b6167652d646973636f766572792f762f737461626c65)](https://packagist.org/packages/myerscode/package-discovery)[![Total Downloads](https://camo.githubusercontent.com/aa7c70d28c93d0fc127388f43f5d01ad7765aa411debf9fe9e27417f6b541c05/68747470733a2f2f706f7365722e707567782e6f72672f6d79657273636f64652f7061636b6167652d646973636f766572792f646f776e6c6f616473)](https://packagist.org/packages/myerscode/package-discovery)[![PHP Version Require](https://camo.githubusercontent.com/c179e0e7d2e14bb7f4ee3ed7d32980c585f538cd273dc313c7fa78aa6503fb09/687474703a2f2f706f7365722e707567782e6f72672f6d79657273636f64652f7061636b6167652d646973636f766572792f726571756972652f706870)](https://packagist.org/packages/myerscode/package-discovery)[![License](https://camo.githubusercontent.com/c4bdf6b378d6352e09ff3d8f7ca83fda05ee9bec42af533c3c5fc5c08fe64468/68747470733a2f2f706f7365722e707567782e6f72672f6d79657273636f64652f7061636b6167652d646973636f766572792f6c6963656e7365)](https://github.com/myerscode/package-discovery/blob/main/LICENSE)[![Tests](https://github.com/myerscode/package-discovery/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/myerscode/package-discovery/actions/workflows/tests.yml)[![codecov](https://camo.githubusercontent.com/b97a3b4bf3951b97a5a15a7f64248840a690b05edb8ca530be887d501f215d87/68747470733a2f2f636f6465636f762e696f2f67682f6d79657273636f64652f7061636b6167652d646973636f766572792f67726170682f62616467652e737667)](https://codecov.io/gh/myerscode/package-discovery)

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

[](#requirements)

- PHP ^8.5

Install
-------

[](#install)

```
composer require myerscode/package-discovery
```

Usage
-----

[](#usage)

Publishing projects add metadata to their `composer.json` `extra` field. A consuming project instantiates a `Finder`and uses it to discover, inspect, and locate those packages.

### Publishing a package

[](#publishing-a-package)

Add an object under your namespace key in the `extra` field of `composer.json`:

```
{
  "name": "myerscode/corgis",
  "extra": {
    "myerscode": {
      "corgis": ["Gerald", "Rupert"],
      "providers": [
        "Myerscode\\Corgis\\CorgiProvider"
      ]
    }
  }
}
```

### Discovering packages

[](#discovering-packages)

Pass the root path of your project (where `vendor/` lives) to `Finder`, then call `discover()` with your namespace.

```
$finder = new Finder(__DIR__);

$packages = $finder->discover('myerscode');
```

Returns an array keyed by package name:

```
[
    'myerscode/corgis' => [
        'corgis' => ['Gerald', 'Rupert'],
        'providers' => ['Myerscode\\Corgis\\CorgiProvider'],
    ],
]
```

You can also discover across multiple namespaces at once by passing an array. Results are merged by package name:

```
$packages = $finder->discover(['myerscode', 'corgi']);
```

### Avoiding discovery

[](#avoiding-discovery)

To exclude a specific package from discovery, add it to the `avoid` list under your namespace in the consuming project's `composer.json`:

```
{
  "name": "myerscode/demo-project",
  "extra": {
    "myerscode": {
      "avoid": ["myerscode/corgis"]
    }
  }
}
```

To skip all discoverable packages entirely, use `*`:

```
{
  "name": "myerscode/demo-project",
  "extra": {
    "myerscode": {
      "avoid": ["*"]
    }
  }
}
```

### Discovering all packages with extras

[](#discovering-all-packages-with-extras)

`discoverAll()` returns every installed package that has any `extra` metadata, regardless of namespace:

```
$packages = $finder->discoverAll();

// [
//     'myerscode/corgis' => [
//         'myerscode' => [...],
//     ],
// ]
```

### Discovering by Composer package type

[](#discovering-by-composer-package-type)

`discoverByType()` filters discovery results to packages of a specific Composer `type`:

```
// Only return packages of type "composer-plugin" that register under the myerscode namespace
$plugins = $finder->discoverByType('composer-plugin', 'myerscode');

// Also works with multiple namespaces
$plugins = $finder->discoverByType('composer-plugin', ['myerscode', 'corgi']);
```

Checking if a package is installed
----------------------------------

[](#checking-if-a-package-is-installed)

`has()` returns `true` if the named package is present in the installed packages list:

```
if ($finder->has('myerscode/corgis')) {
    // package is installed
}
```

Listing installed package names
-------------------------------

[](#listing-installed-package-names)

`installedPackageNames()` returns a flat array of all installed package names:

```
$names = $finder->installedPackageNames();

// ['myerscode/utilities-bags', 'myerscode/corgis', ...]
```

Locating a package
------------------

[](#locating-a-package)

`locate()` returns the absolute path to a package on disk. Throws `PackageNotFoundException` if the package is unknown or its directory cannot be resolved:

```
$path = $finder->locate('myerscode/corgis');

// /var/www/project/vendor/myerscode/corgis
```

Getting package extras
----------------------

[](#getting-package-extras)

`packageExtra()` returns the full `extra` array for a package:

```
$extra = $finder->packageExtra('myerscode/corgis');

// [
//     'myerscode' => [
//         'corgis' => ['Gerald', 'Rupert'],
//         'providers' => ['Myerscode\\Corgis\\CorgiProvider'],
//     ],
// ]
```

Getting package meta for a service
----------------------------------

[](#getting-package-meta-for-a-service)

`packageMetaForService()` returns only the `extra` data scoped to a specific namespace key:

```
$meta = $finder->packageMetaForService('myerscode/corgis', 'myerscode');

// [
//     'corgis' => ['Gerald', 'Rupert'],
//     'providers' => ['Myerscode\\Corgis\\CorgiProvider'],
// ]
```

Exceptions
----------

[](#exceptions)

All lookup methods (`locate`, `packageExtra`, `packageMetaForService`) throw `Myerscode\PackageDiscovery\Exceptions\PackageNotFoundException` when the requested package is not found. `PackageNotFoundException` extends `InvalidArgumentException`, so existing catch blocks continue to work.

```
use Myerscode\PackageDiscovery\Exceptions\PackageNotFoundException;

try {
    $path = $finder->locate('vendor/unknown-package');
} catch (PackageNotFoundException $e) {
    // handle missing package
}
```

Issues
------

[](#issues)

Bug reports and feature requests can be submitted on the [Github Issue Tracker](https://github.com/myerscode/package-discovery/issues).

Contributing
------------

[](#contributing)

See the Myerscode [contributing](https://github.com/myerscode/docs/blob/master/contributing.md) page for information.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance91

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 97.8% 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 ~646 days

Total

3

Last Release

85d ago

Major Versions

1.0.0 → 2025.0.02025-02-13

2025.0.0 → 2026.0.02026-04-10

PHP version history (3 changes)1.0.0PHP ^8.1

2025.0.0PHP ^8.4

2026.0.0PHP ^8.5

### Community

Maintainers

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

---

Top Contributors

[![oniice](https://avatars.githubusercontent.com/u/2676321?v=4)](https://github.com/oniice "oniice (45 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

composerdiscoverypluginsmeta

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/myerscode-package-discovery/health.svg)

```
[![Health](https://phpackages.com/badges/myerscode-package-discovery/health.svg)](https://phpackages.com/packages/myerscode-package-discovery)
```

###  Alternatives

[jean85/pretty-package-versions

A library to get pretty versions strings of installed dependencies

1.3k315.9M84](/packages/jean85-pretty-package-versions)[ergebnis/composer-normalize

Provides a composer plugin for normalizing composer.json.

1.1k41.5M2.8k](/packages/ergebnis-composer-normalize)[bamarni/composer-bin-plugin

No conflicts for your bin dependencies

53024.4M1.1k](/packages/bamarni-composer-bin-plugin)[composer/metadata-minifier

Small utility library that handles metadata minification and expansion.

181123.3M25](/packages/composer-metadata-minifier)[shipmonk/composer-dependency-analyser

Fast detection of composer dependency issues (dead dependencies, shadow dependencies, misplaced dependencies)

6198.4M667](/packages/shipmonk-composer-dependency-analyser)

PHPackages © 2026

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