PHP code example of shipmonk / modulint

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

    

shipmonk / modulint example snippets


 declare(strict_types = 1);

use ShipMonk\Modulint\Config\Configuration;
use ShipMonk\Modulint\Module;
use ShipMonk\Modulint\ModuleIdentifier;

enum AppModule: string implements ModuleIdentifier
{
    case Api = 'Api';
    case Doctrine = 'Doctrine';
    case Logging = 'Logging';
    case VendorDoctrine = 'VendorDoctrine';
    case VendorPsrLog = 'VendorPsrLog';
}

return (new Configuration())
    ->addModule(new Module(
        AppModule::Api,
        paths: ['src/Api'],
        dependencies: [AppModule::Doctrine, AppModule::Logging],
    ))
    ->addModule(new Module(
        AppModule::Doctrine,
        paths: ['src/Doctrine'],
        dependencies: [AppModule::VendorDoctrine],
    ))
    ->addModule(new Module(
        AppModule::Logging,
        paths: ['src/Logging'],
        dependencies: [AppModule::VendorPsrLog],
    ))

    // vendors with `dependencies: null` may be depended on by anyone and never report unused/forbidden
    ->addModule(new Module(AppModule::VendorDoctrine, ['vendor/doctrine'], dependencies: null))
    ->addModule(new Module(AppModule::VendorPsrLog, ['vendor/psr/log'], dependencies: null))

    // every file under src/ must belong to some module
    ->addFullyModulizedDirectory('src');