PHP code example of takemo101 / simple-module

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

    

takemo101 / simple-module example snippets




namespace Other\Sync;

use Takemo101\SimpleModule\Support\ {
    InstallerInterface,
    ServiceProvider,
};

/**
 * Module files are Laravel's service provider, so you can use them in the same way.
 */
class Module extends ServiceProvider implements InstallerInterface
{
    public function register()
    {
        //
    }

    public function boot()
    {
        //
    }

    /**
     * module install process
     *
     * @return void
     */
    public function install()
    {
        // Write the process when installing the module.
    }

    /**
     * module uninstall process
     *
     * @return void
     */
    public function uninstall()
    {
        // Write the process when uninstalling the module.
    }

    /**
     * install packages
     *
     * Set the package string to the key of the associative array.
     * For the value of the associative array, set whether to uninstall or not with boolean type.
     *
     * @return boolean[]
     */
    public function packages(): array
    {
        return [
            'bensampo/laravel-enum' => true, // It is deleted at the same time as uninstalling
            'jeroennoten/laravel-adminlte' => false, // Not deleted even if uninstalled
        ];
    }
}

php artisan simple-module:create ModuleName

or

php artisan simple-module:create ModuleName --namespace=OtherModuleNamespace