PHPackages                             kent013/artisan-command-pseudo-ca - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kent013/artisan-command-pseudo-ca

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kent013/artisan-command-pseudo-ca
=================================

An artisan command to generate usecase / request / resource classes to implement pseudo clean architecture.

v0.0.4(2y ago)113MITPHPPHP ^8.0

Since Aug 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/kent013/artisan-command-pseudo-ca)[ Packagist](https://packagist.org/packages/kent013/artisan-command-pseudo-ca)[ RSS](/packages/kent013-artisan-command-pseudo-ca/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

artisan-command-pseudo-ca
=========================

[](#artisan-command-pseudo-ca)

Artisan make command to generate usecase / request / resource classes to implement pseudo clean architecture.

This command is based on the article about **pseudo** clean architecture.

- 5年間 Laravel を使って辿り着いた，全然頑張らない「なんちゃってクリーンアーキテクチャ」という落としどころ
    -  (Japanese Only)
    - written by mpyw ()

Pseudo / Relaxed Clean Architecture
-----------------------------------

[](#pseudo--relaxed-clean-architecture)

**pseudo** clean architecture for laravel is a relaxed domain modelling architecture which consists with `Request`, `Resource` and `Usecase`. Again this architecture is proposed by mpyw. And I'm using this architecture in my several projects. so that I just need a class generator.

According to the article written by mpyw, `Request` is like

```
class StoreRequest extends FormRequest
{
    public function authorize(Gate $gate): bool
    {
        $community = $this->route()->parameter('community');
	    return $gate->authorize('store', [Post::class, $community]);
    }

    public function rules(): array
    {
        return [
            'title' => 'required|string|max:30',
            'body' => 'required|string|max:10000',
        ];
    }

    public function makePost(): Post
    {
        return new Post($this->validated());
    }
}
```

`Resource` is like

```
class PostResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'title' => $this->resource->title,
            'body' => $this->resource->body,
            'created_at' => $this->resource->created_at,
            'updated_at' => $this->resource->updated_at,
        ];
    }
}
```

`Usecase` is like

```
class StoreAction
{
    public function storeAfterDomainValidation(User $user, Community $community): self
    {
        $userPostsCountToday = $user
            ->posts()
            ->where('community_id', $community->id)
            ->where('created_at', '>=', Carbon::midnight())
            ->count();
        if ($userPostsCountToday >= 200) {
            throw new PostLimitExceededException('Exceeded');
        }

        $post->save();
        return $post;
    }
}
```

And controller with `Request`, `Resource` and `Usecase` goes like

```
class PostContoller
{
    public function store(StoreRequest $request, StoreAction $action): PostResource
    {
        $post = $request->makePost();

        try {
            return new PostResource($action($user, $community, $post));
        } catch (PostLimitExceededException $e) {
            throw new TooManyRequestsHttpException(null, $e->getMessage(), $e);
        }
    }
}
```

Installation
------------

[](#installation)

```
composer require --dev kent013/artisan-command-pseudo-ca

```

Generate config file
--------------------

[](#generate-config-file)

```
php artisan vendor:publish --tag="pseudoca"

```

Configuration
-------------

[](#configuration)

```
PSEUDOCA_USECASE_NS="\UseCases"
PSEUDOCA_REQUEST_NS="\Http\Requests"
PSEUDOCA_RESOURCE_NS="\Http\Resources"

```

If you want to change namespaces, please add above lines in your `.env` file and change values.

Generate Usecase
----------------

[](#generate-usecase)

```
php artisan make:pseudoca:usecase LoginAction

```

will generates `LoginAction` class under root namespace suffixed with `PSEUDOCA_USECASE_NS`. Default namespace is `\UseCase`.

Generate Request
----------------

[](#generate-request)

```
php artisan make:pseudoca:request LoginRequest

```

will generates `LoginRequest` class under root namespace suffixed with `PSEUDOCA_REQUEST_NS`. Default namespace is `\Http\Requests`.

Generate Resource
-----------------

[](#generate-resource)

```
php artisan make:pseudoca:resource LoginResource

```

will generates `LoginResource` class under root namespace suffixed with `PSEUDOCA_RESOURCE_NS`. Default namespace is `\Http\Resources`.

### Generate PseudoCA classes at once

[](#generate-pseudoca-classes-at-once)

```
php artisan make:pseudoca Login

```

will generates `LoginResource`, `LoginRequest` and `LoginUsecase`.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~105 days

Total

4

Last Release

1061d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/216abcc5179e66b221708ee93ac104a77f4530fec8d8da77959997740eada9cd?d=identicon)[kent013](/maintainers/kent013)

---

Top Contributors

[![kent013](https://avatars.githubusercontent.com/u/356537?v=4)](https://github.com/kent013 "kent013 (20 commits)")

---

Tags

laravelartisanmakeusecase

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/kent013-artisan-command-pseudo-ca/health.svg)

```
[![Health](https://phpackages.com/badges/kent013-artisan-command-pseudo-ca/health.svg)](https://phpackages.com/packages/kent013-artisan-command-pseudo-ca)
```

###  Alternatives

[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
