32
loading...
This website collects cookies to deliver better user experience
composer require — dev phparkitect/phparkitect
wget [https://github.com/phparkitect/arkitect/releases/latest/download/phparkitect.phar](https://github.com/phparkitect/arkitect/releases/latest/download/phparkitect.phar)
chmod +x phparkitect.phar
./phparkitect.phar check
<?php
declare(strict_types=1);
use Arkitect\ClassSet;
use Arkitect\CLI\Config;
use Arkitect\Expression\ForClasses\HaveNameMatching;
use Arkitect\Expression\ForClasses\ResideInOneOfTheseNamespaces;
use Arkitect\Rules\Rule;
return static function (Config $config): void {
$classSet = ClassSet::fromDir(__DIR__ . ‘/src’);
$r1 = Rule::allClasses()
->that(new ResideInOneOfTheseNamespaces(‘App\Order\Infrastructure\Controller’))
->should(new HaveNameMatching(‘*Controller’))
->because(“we want uniform naming”);
$config->add($classSet, $r1);
};
./vendor/bin/phparkitect check
./vendor/bin/phparkitect check — config=/project/yourConfigFile.php
$rule = Rule::allClasses()
->that(new ResideInOneOfTheseNamespaces(‘App\Catalog\Domain’))
->should(new NotHaveDependencyOutsideNamespace(‘App\Catalog\Domain’))
->because(‘domain should not have external dependencies’);
$rule = Rule::allClasses()
->that(new ResideInOneOfTheseNamespaces(‘App\Order\Infrastructure\Controller’))
->should(new HaveNameMatching(‘*Controller’))
->because(“we want uniform naming”);
$rule = Rule::allClasses()
->that(new Extend(AbstractType::class))
->should(new HaveNameMatching(‘*Type’))
->because(‘we want uniform form type naming’);
$rule = Rule::allClasses()
->exclude([‘App\Order\Application\Service\Foo’])
->that(new ResideInOneOfTheseNamespaces(‘App\Order\Application\Service’))
->should(new HaveNameMatching(‘*Service’))
->because(“we want uniform naming”);