PHP code example of yakisova41 / moduleloader

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

    

yakisova41 / moduleloader example snippets



use Yakisova41\ModuleLoader\Loader;

$module = Loader::import('./module.php');

$module(); //=>Hello World!!



use Yakisova41\ModuleLoader\Loader;

Loader::exportDefault(function(){
  echo "Hello World!!";
});


use Yakisova41\ModuleLoader\Loader;

$hellomodule = Loader::import('./module.php', 'Hello');
$byemodule = Loader::import('./module.php', 'bye');
$onemodule = Loader::import('./module.php', 'one');

$hellomodule(); //=>Hello World!!
$byemodule(); //=>Seeyou goodbye

echo $onemodule; //=> 1


use Yakisova41\ModuleLoader\Loader;

//hello
Loader::export('Hello',function(){
  echo "Hello World!!";
});

//bye
$seeyou = function(){
  echo 'Seeyou goodbye';
};
Loader::export('bye',$seeyou);

//one
Loader::export('one',1);