Download the PHP package pollora/discovery without Composer

On this page you can find all versions of the php package pollora/discovery. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package discovery

Pollora Discovery: find the classes that carry attributes, and hand them to the code that registers them

Latest version Total downloads Tests

Scans directories for PHP classes, reads each class once, and hands it to every discovery that wants it: one finds #[Action] methods, another #[PostType] classes, a third REST controllers. Each discovery collects what it found, then applies it in one pass. Scans are cached, a class is reflected once whatever the number of discoveries, and each item is applied once per request.

It is the engine behind Pollora's attributes, and it runs without Laravel: in a WordPress plugin, a Bedrock site or any PHP project.

Part of Pollora, the Laravel framework for WordPress. In a Pollora project it is already installed and wired: themes, plugins and modules are scanned for you, and your own discoveries are picked up from the container. See Auto-discovery.

Installation

Requires PHP 8.3+. It builds on spatie/php-structure-discoverer, which brings illuminate/collections; nothing else from Laravel is needed.

Quick start

A discovery says what it looks for in discover() and what to do with it in apply():

Point the engine at a directory and run it:

run() is discover() then apply(). Running again applies only what is new: an item is never applied twice.

Fitting it to an environment

Every dependency of DiscoveryEngine is optional. Without them, it builds classes by reflection, keeps no persistent cache and runs only the discoveries added to it.

Argument Contract Default
resolver InstanceResolverInterface, builds discoveries given by class name and the classes they find ReflectionInstanceResolver (constructor parameters filled from defaults and class types); ContainerInstanceResolver wraps any PSR-11 container
registrar DiscoveryRegistrarInterface, adds the environment's discoveries before each run none
cacheManager DiscoveryCacheManager, with a Spatie DiscoverCacheDriver no persistent cache
logger PSR-3 none
skipClasses, skipPaths classes, or path fragments, never handed to discoveries none

Caching scans

Scanning walks every file of a location, so cache it outside development. Psr16DiscoverCacheDriver stores scans in any PSR-16 cache, such as WordPress transients or the object cache; Spatie's own drivers work too.

With warnOnSlowScans: true (meant for development, where the cache is off), a location that takes more than 250 ms to scan is logged: it usually holds node_modules, vendor or a build output.

Keeping a class out

Public API

The Pollora\Discovery\Domain\Contracts\* and Pollora\Discovery\Domain\Services\* namespaces are the stable contracts for writing discoveries and follow semantic versioning. Infrastructure classes may change in a minor version.

Testing

License

MIT. See LICENSE.


All versions of discovery with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/collections Version ^11.0|^12.0|^13.0
psr/container Version ^2.0
psr/log Version ^3.0
psr/simple-cache Version ^3.0
spatie/php-structure-discoverer Version ^2.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pollora/discovery contains the following files

Loading the files please wait ...