PHPackages                             kjos/command - 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. [CLI &amp; Console](/categories/cli)
4. /
5. kjos/command

ActiveLibrary[CLI &amp; Console](/categories/cli)

kjos/command
============

Command tool for Laravel and other

3.3.5(7mo ago)01.4kMITPHPPHP ^8.2

Since Apr 3Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/jeankoffi543/3kjos-command)[ Packagist](https://packagist.org/packages/kjos/command)[ RSS](/packages/kjos-command/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (18)Versions (62)Used By (0)

3kjos-command for Laravel
=========================

[](#3kjos-command-for-laravel)

OVERVIEW
========

[](#overview)

3kjos Command is a Laravel package that provides a powerful command-line tool to quickly generate a complete API structure, including routes, controllers, models, form requests, resources, migrations, and tests. With just one command, you can scaffold an entire API module, significantly reducing development time and maintaining consistency across your project.

Features
========

[](#features)

### Automatic API Generation

[](#automatic-api-generation)

- Adds API route to `api.php` (index, show, store, put, delete)
- Generates a `controller` with all CRUD methods.
- Add `resource class` to structure API responses.
- Builds a `model` with its table name, fillable fields, and relationships.
- Generates a `form request class` with validation rules.
- Creates a `migration` with predefined fields.
- Generates `feature tests` for the API.

### Error Handling with `errorHandler` (Optional)

[](#error-handling-with-errorhandler-optional)

- Centralizes error management across controllers.
- Handles `ModelNotFoundException`, `QueryException`, and other errors.
- Ensures proper HTTP responses: `404`, `403`, `422`, `500`.

### Centralized Controller Logic (Optional)

[](#centralized-controller-logic-optional)

- Uses a `Central` service to handle CRUD operations.
- Reduces code duplication by managing common logic in one place.

### Factory Generation

[](#factory-generation)

- Creates a `factory` for the model with relevant attributes.
- Simplifies database seeding and testing.

Installation
============

[](#installation)

`composer require kjos/command`

Usage
=====

[](#usage)

`php artisan kjos:make:api name`

- Replace `name` with the desired API entity (e.g., `user`, `product`).
- This will create all necessary files and append routes automatically.

Available Options
=================

[](#available-options)

OptionAliasDescription`--force``-f`Overwrites existing files if they exist.`--errorhandler``-er`Enables centralized error handling for controller methods.`--centralize``-c`Uses a central class to manage CRUD operations.`--factory`Generates a model factory with sample data.`--test`Generates tests files relative to a madel.Example with Options
====================

[](#example-with-options)

`php artisan kjos:make:api User --force --errorhandler --centralize --factory --test`

This command will: ✅ Overwrite existing files. ✅ Enable centralized error handling. ✅ Use a central CRUD management system. ✅ Generate a factory for the User model.

Example Generated Code
======================

[](#example-generated-code)

### Controller with Error Handling (--errorhandler or -er)

[](#controller-with-error-handling---errorhandler-or--er)

```
 public function store(UserRequest $request)
{
    return $this->errorHandler(function () use ($request) {
      return new UserResource(User::create($request->validated()));
    });
}
```

**Error Handling with errorHandler Method**The `errorHandler` method is a utility function designed to execute a callable while handling various exceptions that may occur. It provides robust error handling and ensures that different types of errors are appropriately managed.

- **ModelNotFoundException**: If a model is not found, the method returns a `404 Not Found` response.
- **QueryException**: For security, reasons catches database query errors and returns a 404 Not Found response.
- **General Exceptions**: The method checks the exception code and handles it as follows:

    - `404`: Returns a `404 Not Found` response.
    - `403`: Returns a `403 Forbidden` response with the error message.
    - `422`: Returns a `403 Forbidden` response with the error message.
    - `Other errors`: A generic `500 Internal Server Error` response is returned with the exception message.

This approach ensures that your application responds to errors with proper HTTP status codes, making error handling more predictable and user-friendly.

### Controller with Centralized Logic (--centralize or -c)

[](#controller-with-centralized-logic---centralize-or--c)

```
 public function store(Request $request)
{
   return $this->errorHandler(function () use ($request) {
      return Central::store(User::class, UserResource::class, $request->validated());
  });
}
```

Centralized management of `index`, `show`, `store`, `update` and `delete` methods

### -Generated Factory (--factory)

[](#-generated-factory---factory)

```
public function definition(): array
{
   return [
      'client_id' => 11,
      'price' => 6765610,
      'partner_id' => 25,
   ];
}
```

Why Use 3kjos Command?
======================

[](#why-use-3kjos-command)

🚀 Save Development Time – Automates repetitive tasks. ✅ Consistency – Ensures a structured and uniform API architecture. 🔧 Customizable – Offers multiple options for error handling, centralization, and testing. 📦 Scalable – Easily extendable for future enhancements.

License
=======

[](#license)

This package is open-source and available under the MIT License. 🚀

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance66

Regular maintenance activity

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 98.1% 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 ~20 days

Recently: every ~9 days

Total

27

Last Release

229d ago

Major Versions

1.0.3 → 2.0.02025-02-03

v2.1.5 → 3.0.02025-07-08

PHP version history (3 changes)v1.0.0PHP ^7.0|^8.0

v2.1.5PHP &gt;=7.0

3.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d8b4bf689202fe6d45f906d4c2b90e7bae704df82aac00e1df5f16e5dfd7a34?d=identicon)[jeankoffi543](/maintainers/jeankoffi543)

---

Top Contributors

[![jeankoffi543](https://avatars.githubusercontent.com/u/26505861?v=4)](https://github.com/jeankoffi543 "jeankoffi543 (53 commits)")[![J-marcel](https://avatars.githubusercontent.com/u/67609064?v=4)](https://github.com/J-marcel "J-marcel (1 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kjos-command/health.svg)

```
[![Health](https://phpackages.com/badges/kjos-command/health.svg)](https://phpackages.com/packages/kjos-command)
```

###  Alternatives

[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[laravel/ranger

Laravel Ranger is a powerful introspection library for Laravel applications.

5138.9k4](/packages/laravel-ranger)

PHPackages © 2026

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