Download the PHP package myerscode/package-discovery without Composer
On this page you can find all versions of the php package myerscode/package-discovery. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package package-discovery
Package Discovery
A service to help easily find plugins for your services, using Composer metadata!
Requirements
- PHP ^8.5
Install
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
Add an object under your namespace key in the extra field of composer.json:
Discovering packages
Pass the root path of your project (where vendor/ lives) to Finder, then call discover() with your namespace.
Returns an array keyed by package name:
You can also discover across multiple namespaces at once by passing an array. Results are merged by package name:
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:
To skip all discoverable packages entirely, use *:
Discovering all packages with extras
discoverAll() returns every installed package that has any extra metadata, regardless of namespace:
Discovering by Composer package type
discoverByType() filters discovery results to packages of a specific Composer type:
Checking if a package is installed
has() returns true if the named package is present in the installed packages list:
Listing installed package names
installedPackageNames() returns a flat array of all installed package names:
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:
Getting package extras
packageExtra() returns the full extra array for a package:
Getting package meta for a service
packageMetaForService() returns only the extra data scoped to a specific namespace key:
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.
Issues
Bug reports and feature requests can be submitted on the Github Issue Tracker.
Contributing
See the Myerscode contributing page for information.
License
The MIT License (MIT). Please see License File for more information.
All versions of package-discovery with dependencies
myerscode/utilities-bags Version ^2026
myerscode/utilities-files Version ^2026