PHP code example of cosmira / soda

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

    

cosmira / soda example snippets




use Cosmira\Soda\Config\Soda;
use Cosmira\Soda\Rules\Complexity\MaxCyclomaticComplexity;
use Cosmira\Soda\Rules\Structure\MaxArguments;

return Soda::configure()
    ->withPaths(['src/'])
    ->with([
        new MaxCyclomaticComplexity(10),
        new MaxArguments(5),
    ]);



use Cosmira\Soda\Config\RuleCatalog;
use Cosmira\Soda\Config\Soda;
use Cosmira\Soda\Rules\Architecture\ForbiddenDependencies;

return Soda::configure()
    ->withPaths(['src/'])
    ->with([
        ...RuleCatalog::standard(),
        new ForbiddenDependencies([
            'App\Domain' => ['App\Infrastructure', 'App\Http'],
            'App\Support' => ['App\Domain'],
        ]),
    ]);