1. Go to this page and download the library: Download laragear/discover library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
laragear / discover example snippets
use Laragear\Discover\Facades\Discover;
foreach (Discover::in('Rules') as $rule) {
// ...
};
use Laragear\Discover\Facades\Discover;
$classes = Discover::withMethod('handle')->in('Scoreboards')->allClasses();
use Laragear\Discover\Facades\Discover;
// Discover starting at the "my-project/score" using "Score" as the base namespace.
$classes = Discover::at('score')->classes();
// Discover starting at the "my-project/match" using the "Matches" as the base namespace.
$classes = Discover::at('/match', 'Matches')->classes();
use Laragear\Discover\Facades\Discover;
$classes = Discover::in('Scoreboards')->classes();
use Laragear\Discover\Facades\Discover;
use App\Score\Contracts\Score;
use App\Score\Concerns\FiresEvents;
use App\Attributes\Subscribable;
// Filter all classes instances of at least one of the given classes/interfaces.
Discover::in('Scoreboards')->instancesOf(ScoreContract::class)->classes();
// Filter all classes with at least one of the given public methods.
Discover::in('Scoreboards')->withMethod('show')->classes();
// Filter all classes with at least one of the given public properties.
Discover::in('Scoreboards')->withProperty('user')->classes();
// Filter all classes with at least one of the given traits.
Discover::in('Scoreboards')->withTrait(FiresEvents::class)->classes();
// Filter all classes with at least one of the given attributes.
Discover::in('Scoreboards')->withAttribute(Subscribable::class)->classes();
use Laragear\Discover\Facades\Discover;
use Illuminate\Support\Str;
$classes = Discover::in('Scoreboards')
->classes()
->filter(fn ($class) => Str::endsWith($class->getName(), 'Score'));
use Laragear\Discover\Facades\Discover;
// Find all classes in `App\Scoreboards`.
$classes = Discover::in('Scoreboards')->classes();
use Laragear\Discover\Facades\Discover;
// Find all classes in `App\Scoreboards` and deeper.
$classes = Discover::in('Scoreboards')->recursively()->classes();
// Same as...
$classes = Discover::in('Scoreboards')->allClasses();
use Laragear\Discover\Facades\Discover;
foreach (Discover::recursive()->in('Scoreboards') as $class) {
// ...
}
use Laragear\Discover\Facades\Discover;
$classes = Discover::in('Scoreboards')->map->isFinal();
use Laragear\Discover\Discoverer;
$discoverer = new Discoverer(__DIR__ . '/..');
foreach ($discoverer->at('software', 'Application')->in('Events') as $event) {
// ...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.