1. Go to this page and download the library: Download saeedhosan/module-support 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/ */
saeedhosan / module-support example snippets
[
'directory' => 'modules', // Where your modules live
'namespace' => 'Modules', // The root namespace for modules
'lowercase' => true, // Normalize module names to lowercase
'vendor' => 'modules', // Vendor directory for module packages
'view_path' => 'resources/views',
'app_path' => 'app',
]
use SaeedHosan\Module\Support\ModuleManager;
$modules = app(ModuleManager::class);
$blog = $modules->module('blog');
// Or use the helper
$blog = module('blog');
$blog->name(); // "Blog"
$blog->path(); // "/path/to/modules/Blog"
$blog->namespace(); // "Modules\Blog"
$blog->version(); // "1.0.0"
$blog->exists(); // true/false
$blog->active(); // true/false (checks if autoloaded & discovered)
foreach (module()->all() as $module) {
echo $module->name();
echo $module->path();
}
if (module()->find('blog')) {
// Blog module is here and ready to go
}
$module = module('blog');
$module->composer(); // Full composer.json contents
$module->providers(); // ['Modules\Blog\Providers\BlogServiceProvider']
$module->description(); // "A simple blogging module"
// Get the module manager
module();
// Get a specific module
module('blog');
// Get all modules
module()->all();
// Check if a module exists
module()->find('blog');