1. Go to this page and download the library: Download mortexa/laravel-arkitect 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/ */
mortexa / laravel-arkitect example snippets
namespace Tests\Architecture;
use Arkitect\Rules\DSL\ArchRule;
use Mortexa\LaravelArkitect\Contracts\RuleContract;
use Mortexa\LaravelArkitect\Rules\BaseRule;
class ControllersNaming extends BaseRule implements RuleContract
{
/**
* Define your architectural rule
*
* @link https://github.com/phparkitect/arkitect
*
* @return \Arkitect\Rules\DSL\ArchRule
*/
public static function rule(): ArchRule
{
// TODO: Implement rule() method.
}
/**
* Define the path related to your rule
*
* @example app/Http/Controllers
*
* @return string
*/
public static function path(): string
{
// TODO: Implement path() method.
}
}
namespace Tests\Architecture;
use Arkitect\Expression\ForClasses\HaveNameMatching;
use Arkitect\Expression\ForClasses\ResideInOneOfTheseNamespaces;
use Arkitect\Rules\DSL\ArchRule;
use Arkitect\Rules\Rule;
use Mortexa\LaravelArkitect\Contracts\RuleContract;
use Mortexa\LaravelArkitect\Rules\BaseRule;
class ControllersNaming extends BaseRule implements RuleContract
{
public static function rule(): ArchRule
{
return Rule::allClasses()
->that(new ResideInOneOfTheseNamespaces('App\Http\Controllers'))
->should(new HaveNameMatching('*Controller'))
->because('It\'s a Laravel naming convention');
}
public static function path(): string
{
return 'app/Http/Controllers';
}
}