| Ratings |   | Unique User Downloads |   | Download Rankings | 
| Not enough user ratings |  | Total: 260  |  | All time:  7,814 This week: 455  | 
 | 
| Description |   | Author  | 
This class can load one or more PHP scripts from a directory. 
 
It can take a given directory and loads all files with valid extension in that directory that have a given file name extension. 
 
The class supports multiple file name extensions to check and defaults to .php . 
 
The script files can be loaded with either include or require.  |  | 
 
  | 
Example
<?php 
 
/* Add the autoload */ 
require('../dist/php/autoload.php'); 
 
/* Call the class `FileLoader` */ 
use \FPHP_Loader\FileLoader; 
 
/**  
* Example: Set extension, loading file and 'path' 
*/ 
$ext = ['html', 'htm']; 
$f_loader = new FileLoader(); 
$f_loader->add_extensions($ext); 
$f_loader->load_file('dir_example/wrong_extension.txt'); 
$f_loader->load_file('1.top.php'); 
$f_loader->load_dir('dir_example/'); /* Don't include files with wrong extensions */ 
 
?>
 
 | 
 
Details
FPHP_Loader
Links:      
PHP Classes and Github
Class of autoload was based on PSR standards to import the classes.   
Split the main class FPHP_Loader in two: ClassLoader and FileLoader.   
___
This class loader files from direct paths, or folder path.   
The class supports multiple file name extensions to check and defaults to .php .   
The script files can be loaded with either include or require.   
___
/php/
  |__ autoload.php
  |__ /fphp/
  |     |__ /loader/
  |            |__ ClassLoader.php
  |            |__ FileLoader.php
  |            |__ ErrorParserLoader.php
  |__ /example/
/example/
  |__ index.file.loader.php [e.g. FileLoader]
  |__ index.class.loader.php [e.g. ClassLoader]
- 
autoload.php: Config and active the class autoload [use ClassLoader];   
 
- 
ClassLoader.php: Loader of classes (php);   
 
- 
FileLoader.php: Loader of files (any type);  
 
- 
ErrorParserLoader.php: Error parser of FileLoader;  
 
___
Example Autoload
Require autoload and call the classes   
require('./php/autoload.php');
use \Example\SuperHero as IronMan;
IronMan::says();
Example FileLoader
Require autoload and call the classes   
require('./php/autoload.php');
use \FPHP_Loader\FileLoader;
$ext = ['html', 'htm'];
$loader = new FileLoader();
$loader->add_extensions($ext);
$loader->load_file('header.php');
$loader->load_dir('content/');
___
Also look ~
 
 
|   | 
Applications that use this package | 
  | 
No pages of applications that use this class were specified.
 If you know an application of this package, send a message to the author to add a link here.