Download the PHP package laragear/discover without Composer

On this page you can find all versions of the php package laragear/discover. 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 discover

Discover

Latest Version on Packagist Latest stable test run Codecov coverage Maintainability Sonarcloud Status Laravel Octane Compatibility

Discover and filter PHP Classes within a directory.

Become a sponsor

Your support allows me to keep this package free, up-to-date and maintainable. Alternatively, you can spread the word!

Requisites

Installation

You can install the package via Composer:

Usage

The Discover finds classes under a given project path. It contains fluent methods to filter the classes to discover, like method and property names, interfaces, traits, and attributes.

Let's make a simple example: list all classes that include the method handle(), inside the App\Scoreboards or deeper.

The Discover class will automatically resolve your project path, and use your application path (app) and namespace (App) as the base to find the matching classes.

[!IMPORTANT]

The discovered classes must be PSR-4 autoloaded.

Application path and namespace

Most Laravel projects use the app and App as the application path and namespace, respectively. The library will use these, or any other set for your application.

To discover classes elsewhere, you will need to use the from() method to change both. If you don't set the namespace, it will be inferred from the path.

Namespace

Use the in() method to set the base namespace to find classes. For example, if we want the classes in the App\Scoreboards namespace, we only need to set Scoreboardsboards.

Filters

You may use the included filters to find classes that are instances of another class, or contains a given member or attribute.

Additional filters

Since the classes are returned as ReflectionClass instances inside a Collection, you can further filter the list. For example, filter all the class names that don't end with Score.

Retrieving classes

Once you're done building, you can retrieve the found classes as a Collection using classes().

The Discover class only looks for classes in the namespace set. To make the search recursive, you can use allClasses(), or set recursive() before the retrieval.

In any case, the Discoverer itself is iterable, so you can immediately use it inside a foreach loop.

You may also pass down any method Collection method or High Order method directly, which may save you a few keystrokes.

Outside Laravel

It's possible to use the Discoverer outside Laravel projects, as it only requires the illuminate/support library. You may need to set your project root path manually.

Laravel Octane compatibility

There should be no problems using this package with Laravel Octane.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Licence

This specific package version is licensed under the terms of the MIT License, at time of publishing.

Laravel is a Trademark of Taylor Otwell. Copyright © 2011-2024 Laravel LLC.


All versions of discover with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
symfony/finder Version 6.*|7.*
illuminate/support Version 10.*|11.*
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 laragear/discover contains the following files

Loading the files please wait ....