PHP code example of tueena-lib / loader

1. Go to this page and download the library: Download tueena-lib/loader 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/ */

    

tueena-lib / loader example snippets




// Create an instance of the Loader class.
$loader = new Loader;

// Define a directory, where classes of a namespace are found.
// Namespaces are defined without leading and trailing backslashes.
// Directories without trailing slashes.
$loader->addNamespaceDirectory('my\\namespace', '/path/to/my/class/files');

// Or define a closure as loader. This closure will be called with the
// class name as parameter and must return true if the class could be
// loaded and false otherwise.
$loader->addLoader(function ($className) {
	if (!$className === 'my\\special\\class')
		return false;