{"id":18872305,"url":"https://github.com/smortexa/laravel-arkitect","last_synced_at":"2025-10-25T04:34:57.990Z","repository":{"id":53763606,"uuid":"514260591","full_name":"smortexa/laravel-arkitect","owner":"smortexa","description":"Test and enforce architectural rules in your Laravel applications. Keep your app's architecture clean and consistent!","archived":false,"fork":false,"pushed_at":"2025-05-06T13:35:15.000Z","size":232,"stargazers_count":115,"open_issues_count":2,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-10T17:56:08.800Z","etag":null,"topics":["architecture","laravel","php","testing"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smortexa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-07-15T12:25:12.000Z","updated_at":"2025-09-11T22:48:51.000Z","dependencies_parsed_at":"2025-05-19T03:31:00.014Z","dependency_job_id":null,"html_url":"https://github.com/smortexa/laravel-arkitect","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/smortexa/laravel-arkitect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smortexa%2Flaravel-arkitect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smortexa%2Flaravel-arkitect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smortexa%2Flaravel-arkitect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smortexa%2Flaravel-arkitect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smortexa","download_url":"https://codeload.github.com/smortexa/laravel-arkitect/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smortexa%2Flaravel-arkitect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280906492,"owners_count":26411399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["architecture","laravel","php","testing"],"created_at":"2024-11-08T05:29:25.810Z","updated_at":"2025-10-25T04:34:57.954Z","avatar_url":"https://github.com/smortexa.png","language":"PHP","readme":"![art/laravel-arkitect.png](art/laravel-arkitect.png)\n# Laravel Arkitect\n\n[![Latest Stable Version](http://poser.pugx.org/mortexa/laravel-arkitect/v)](https://packagist.org/packages/mortexa/laravel-arkitect) [![Total Downloads](http://poser.pugx.org/mortexa/laravel-arkitect/downloads)](https://packagist.org/packages/mortexa/laravel-arkitect) [![Latest Unstable Version](http://poser.pugx.org/mortexa/laravel-arkitect/v/unstable)](https://packagist.org/packages/mortexa/laravel-arkitect) [![License](http://poser.pugx.org/mortexa/laravel-arkitect/license)](https://packagist.org/packages/mortexa/laravel-arkitect) [![PHP Version Require](http://poser.pugx.org/mortexa/laravel-arkitect/require/php)](https://packagist.org/packages/mortexa/laravel-arkitect)\n\nLaravel Arkitect lets you test and enforce your architectural rules in your Laravel applications, and it's\na [PHPArkitect](https://github.com/phparkitect/arkitect) wrapper for Laravel. This package helps you to keep your app's\narchitecture clean and consistent.\n\n```\n├─ storage\n├─ tests\n│   ├─ Architecture ✅\n│   ├─ Browser\n│   ├─ Feature\n│   └─ Unit\n└─ vendor\n```\n\n## Installation\n\nYou can install the package via Composer:\n\n```\ncomposer require mortexa/laravel-arkitect --dev\n```\n\n## Usage\n\nFirst, you should create your architectural rules by running the following Artisan command:\n\n`php artisan make:arkitect ControllersNaming`\n\nBy running the command, the `ControllersNaming.php` file will be created in your application's `tests/Architecture` directory like this:\n\n```php\n\u003c?php\n\nnamespace Tests\\Architecture;\n\nuse Arkitect\\Rules\\DSL\\ArchRule;\nuse Mortexa\\LaravelArkitect\\Contracts\\RuleContract;\nuse Mortexa\\LaravelArkitect\\Rules\\BaseRule;\n\nclass ControllersNaming extends BaseRule implements RuleContract\n{\n    /**\n     * Define your architectural rule\n     *\n     * @link https://github.com/phparkitect/arkitect\n     *\n     * @return \\Arkitect\\Rules\\DSL\\ArchRule\n     */\n    public static function rule(): ArchRule\n    {\n        // TODO: Implement rule() method.\n    }\n\n    /**\n     * Define the path related to your rule\n     *\n     * @example app/Http/Controllers\n     *\n     * @return string\n     */\n    public static function path(): string\n    {\n        // TODO: Implement path() method.\n    }\n}\n```\nThen, you must implement `rule()` and `path()` methods based on the following [example](#example).\n\nAnd finally, you can run your tests by the following command:\n\n`php artisan test:arkitect`\n\nDone!\n\n\u003e If you want to stop checking command immediately after first violation, you can use `--stop-on-failure` option.\n\nFor all available rules, please take a look at the PHPArkitect repository: https://github.com/phparkitect/arkitect\n\n### Default rules\n\nSome opinionated rules are provided by the package and apply by default. These rules are about Laravel user-land structure. You are free to customize or ignore them entirely by [publishing config file](#configuration).\n\n## Example\n\n```php\n\u003c?php\n\nnamespace Tests\\Architecture;\n\nuse Arkitect\\Expression\\ForClasses\\HaveNameMatching;\nuse Arkitect\\Expression\\ForClasses\\ResideInOneOfTheseNamespaces;\nuse Arkitect\\Rules\\DSL\\ArchRule;\nuse Arkitect\\Rules\\Rule;\nuse Mortexa\\LaravelArkitect\\Contracts\\RuleContract;\nuse Mortexa\\LaravelArkitect\\Rules\\BaseRule;\n\nclass ControllersNaming extends BaseRule implements RuleContract\n{\n    public static function rule(): ArchRule\n    {\n        return Rule::allClasses()\n            -\u003ethat(new ResideInOneOfTheseNamespaces('App\\Http\\Controllers'))\n            -\u003eshould(new HaveNameMatching('*Controller'))\n            -\u003ebecause('It\\'s a Laravel naming convention');\n    }\n\n    public static function path(): string\n    {\n        return 'app/Http/Controllers';\n    }\n}\n```\n\n## Configuration\n\nIf you want to customize the default rules provided by the package, You can publish the Laravel Arkitect configuration file using the following Artisan command:\n\n`php artisan vendor:publish --provider=\"Mortexa\\LaravelArkitect\\ArkitectServiceProvider\" --tag=\"config\"`\n\nThe `arkitect` configuration file will be placed in your application's `config` directory.\n\n```php\n// config/arkitect.php\n\n\u003c?php\n\nuse ...\n\nreturn [\n    'rules' =\u003e [\n        'naming' =\u003e [\n            ControllersNaming::class,\n            ExceptionsNaming::class,\n            NotificationsNaming::class,\n            ObserversNaming::class,\n            ProvidersNaming::class,\n            RequestsNaming::class,\n            ResourcesNaming::class,\n            ChannelsNaming::class,\n            SeedersNaming::class,\n            PoliciesNaming::class,\n            FactoriesNaming::class,\n            ScopesNaming::class,\n            BuildersNaming::class,\n            ContractsNaming::class,\n            RepositoriesNaming::class,\n            MailsNaming::class,\n        ],\n        'extending' =\u003e [\n            ControllersExtending::class,\n            CommandsExtending::class,\n            ExceptionsExtending::class,\n            RequestsExtending::class,\n            ResourcesExtending::class,\n            ResourceCollectionsExtending::class,\n            ModelsExtending::class,\n            NotificationsExtending::class,\n            ProvidersExtending::class,\n            ViewsExtending::class,\n            FactoriesExtending::class,\n            SeedersExtending::class,\n            MailsExtending::class,\n        ],\n        'implementing' =\u003e [\n            RulesImplementing::class,\n            CastsImplementing::class,\n            ScopesImplementing::class,\n            JobsImplementing::class,\n        ],\n    ],\n    'ignored_namespaces' =\u003e [],\n];\n```\n### Ignore namespaces\nIf you want to ignore any namespaces from being under architectural test, you should add the related path to `ignored_namespaces` key in configuration file.\n## Contributing\n\nThank you for considering contributing! If you find an issue, or have a better way to do something, feel free to open an\nissue, or a PR.\n\n## Licence\n\nThis repository is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmortexa%2Flaravel-arkitect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmortexa%2Flaravel-arkitect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmortexa%2Flaravel-arkitect/lists"}