PHP code example of alex-oleshkevich / classnames
1. Go to this page and download the library: Download alex-oleshkevich/classnames 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/ */
alex-oleshkevich / classnames example snippets
$extractor = new \ClassNames\ClassNames;
$classes = $extractor->getClassNames('/path/to/file.php');
// or
$interfaces = $extractor->getInterfaceNames('/path/to/file.php');
// or
$traits = $extractor->getTraitNames('/path/to/file.php');
// file "/path/to/file.php"
namespace TestAsset {
class Asset {}
class Asset2 {}
}
$extractor = new \ClassNames\ClassNames;
$classes = $extractor->getClassNames('/path/to/file.php');
print_r($classes);
/**
* Array
* (
* [0] => TestAsset\Asset
* [1] => TestAsset\Asset2
* )
*/