PHP code example of lezhnev74 / ddd-generator

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

    

lezhnev74 / ddd-generator example snippets


$config = [
    
    // 3 layers with independent folders for sources and for tests
    "layers" => [
        "app" => [
            "src" => [
                "qcn" => "\\App", // What base namespace to use
                "dir" => __DIR__."/src/app", // Where to put new source files
            ],
            "tests" => [
                "qcn" => "\\Tests", // what base namespace to use
                "dir" => __DIR__."/tests/app", // Where to put new tests files
            ],
        ],
        "domain" => [
            "src" => [
                "qcn" => "\\Domain",
                "dir" => "src/domain",
            ],
            "tests" => [
                "qcn" => "\\Tests",
                "dir" => __DIR__."/tests/domain",
            ],
        ],
        "infrastructure" => [
            "src" => [
                "qcn" => "\\Infrastructure",
                "dir" => __DIR__ . "/src/infrastructure",
            ],
            "tests" => [
                "qcn" => "\\Tests",
                "dir" => __DIR__ . "/tests/infrastructure",
            ],
        ],
    ],
        
    "primitives" => [
        "command" => [
            // these stubs will go to source folder
            "src" => [
                "stubs" => [
                    // See Templates paragraph on placeholders
                    "/*<PSR4_NAMESPACE_LAST>*/Command" => __DIR__ . "/stubs/SimpleStub.stub.php",
                    "/*<PSR4_NAMESPACE_LAST>*/Handler.php" => __DIR__ . "/stubs/SimpleStub.stub.php",
                ],
            ],
            // these files will go to tests folder
            "test" => [
                "stubs" => [
                    "/*<PSR4_NAMESPACE_LAST>*/CommandTest" => __DIR__ . "/stubs/SimpleTestStub.stub.php",
                ],
            ],
        
        ],
    ],
    
];