note 90078 deleted from language.oop5.autoload by crell

From: Date: Mon, 04 Apr 2022 16:11:39 +0000
Subject: note 90078 deleted from language.oop5.autoload by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-218030@lists.php.net to get a copy of this message
Note Submitter: roman dot drapeko at gmail dot com ---- Hi there, I have developed a small script, that can scan recursively folders and files ang generate array of associations between classes/interfaces and their locations. It accepts several incoming parameters and it's very simple to use. An example of generated array is shown bellow. <?php $autoload_list = array ( 'classes' => array ( 'A' => array ('path' => 'Project/Classes/Children/A.php', 'extends' => array (), 'implements' => array ('I1')), 'C' => array ('path' => 'Project/Classes/C.php', 'extends' => array ('B'), 'implements' => array ('I1', 'I3')), ), 'interfaces' => array ( 'I2' => array ('path' => 'Project/Interfaces/blablabla.php', 'extends' => array ('I1')), 'I1' => array ('path' => 'Project/Interfaces/I1.php', 'extends' => array ()), ), ); ?> When you know names and their locations, you know everything to load these classes. It uses regular expressions to identify if class/interfaces is located in the current file. I tried to post the code, but it's very long. You can download the script from http://wp.drapeko.com/store/php-autoloading-files/.

« previous php.notes (#218030) next »