PHP code example of wyrihaximus / list-classes-in-directory
1. Go to this page and download the library: Download wyrihaximus/list-classes-in-directory 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/ */
wyrihaximus / list-classes-in-directory example snippets
use function WyriHaximus\Lister;
// $classes now contains a list of full qualified class names from 'src/' and 'tests/'
$classes = Lister::classesInDirectories(
__DIR__ . '/src',
__DIR__ . '/tests'
);
// use listInstantiatableClassesInDirectories() or listNonInstantiatableClassesInDirectories() to only consider classes that can actually be instantiated, or not.
$instantiatableClasses = Lister::instantiatableClassesInDirectory(
__DIR__ . '/src',
__DIR__ . '/tests'
);
$nonInstantiatableClasses = Lister::nonInstantiatableClassesInDirectory(
__DIR__ . '/src',
__DIR__ . '/tests'
);
use function WyriHaximus\Lister;
// $classes now contains a list of full qualified class names from __DIR__
$classes = Lister::classesInDirectory(__DIR__);
// use listInstantiatableClassesInDirectory() or listNonInstantiatableClassesInDirectory() to only consider classes that can actually be instantiated, or not.
$instantiatableClasses = Lister::instantiatableClassesInDirectory(__DIR__);
$nonInstantiatableClasses = Lister::nonInstantiatableClassesInDirectory(__DIR__);
use function WyriHaximus\Lister;
// $classes now contains a list of full qualified class names from 'Bar.php' and 'Foo.php'
$classes = Lister::classesInFiles(
__DIR__ . '/Bar.php',
__DIR__ . '/Foo.php'
);
use function WyriHaximus\Lister;
// $classes now contains a list of full qualified class names from 'Foo.php'
$classes = Lister::classesInFile(__DIR__.'/Foo.php');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.