PHP code example of stagem / class-finder
1. Go to this page and download the library: Download stagem/class-finder 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/ */
stagem / class-finder example snippets
use Stagem\ClassFinder\ClassFinder;
$class = (new ClassFinder())->getClassFromFile('/path/to/App/ClassName.php');
var_dump($class);
// App\ClassName
use Stagem\ClassFinder\ClassFinder;
$classes = (new ClassFinder())->getClassesInDir('/path/to/App/Model');
var_dump($classes);
/**
* array (
* 0 => '\\App\\Model\\Product',
* 1 => '\\App\\Model\\Cart',
* 2 => '\\App\\Model\\Order',
* 3 => '\\App\\Model\\Shipment',
* )
*/