承接 santoshghimire/crud-generator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

santoshghimire/crud-generator

Composer 安装命令:

composer create-project santoshghimire/crud-generator

包简介

utility service package

README 文档

README

Laravel CRUD Generator is a developer-friendly package for generating clean, scalable, and microservice-ready CRUD modules using modern Laravel best practices.

It follows:

  • Repository Pattern
  • Service Layer Architecture
  • DTOs (Data Transfer Objects)
  • Data Builders
  • Swagger / OpenAPI Controllers
  • Modular structure (Authetication, Shoiiping, etc.) usefull in Nwidart package

This package is ideal for SaaS platforms, OpenApi-AutoSwagger Generate , Microservice, and API-first applications.

📦 Installation & Usage Guide

How to Install

Add Repository Source to composer.json

{
    "type": "vcs",
    "url": "https://gitlab.com/santosh112233/crud-generator",
    "packagist": false,
    "extra": {
        "secret": "auth.json"
    }
}
    composer require santoshghimire/crud-generator:1.0.1

Add Repository source to compose.json file

    {
        "type": "vcs",
        "url": "",
        "packagist": false,
        "extra": {
            "secret": "auth.json"
        }
    }

AND

    
     "require": {
         "santoshghimire/crud-generator": "dev-main"
     }

Make auth.json file at root of project

  • Go to gitlab => edit profile => Auth Token option and generate new one
  • git ignore this auth.json file for security, dont push this file in development
      {
          "gitlab-token": {
              "gitlab.com": "Add your personal access token  that you have created"
          }
      }
    

* `composer require  santoshghimire/crud-generator:dev-main` .
* Fix an error in package discovery if attempting to install both `` 

### Utility Service and examples

php artisan crud:generate Room --m --field=name:string,capacity:integer,price:decimal --module=MicroService


### Scofolding Generate Form This Pckage

Modules/ └── Order/

 ├── Http/
 │   ├── Controllers/
 │   │   └── OrderController.php
 │   └── Requests/
 │       └── OrderRequest.php
 ├── Models/
 │   └── Order.php
 ├── Repositories/
 │   ├── OrderRepository.php
 │   └── Interfaces/
 │       └── OrderRepositoryInterface.php
 ├── Services/
 │   └── OrderService.php
 ├── DTOs/
 │   └── OrderDTO.php
 ├── DataBuilders/
 │   └── OrderDataBuilder.php
 └── Database/
     └── Migrations/create_orders_table.php


### Controlller Generate From this Package
class TenantDetailController extends Controller
{
use ApiResponse;

public function __construct(
    public TenantDetailService $tenantDetailService
) {}

/**
 * @OA\Get(
 *     path="/api/tenantdetails",
 *     summary="Get tenant_details list",
 *     operationId="gettenant_details",
 *     tags={"tenantdetails"},
 *     @OA\Parameter(
 *         name="pagination",
 *         in="query",
 *         required=false,
 *         @OA\Schema(type="boolean", example=true)
 *     ),
 *     @OA\Parameter(
 *         name="X-Tenant",
 *         in="header",
 *         required=true,
 *         @OA\Schema(type="string")
 *     ),
 *     @OA\Response(
 *         response=200,
 *         description="TenantDetail list",
 *         @OA\JsonContent(
 *             @OA\Property(property="status", type="string"),
 *             @OA\Property(property="message", type="string"),
 *             @OA\Property(
 *                 property="data",
 *                 type="array",
 *                 @OA\Items(ref="#/components/schemas/TenantDetailResourceSchema")
 *             )
 *         )
 *     )
 * )
 */
public function index(Request $request)
{
    try {
        $relations = ['tenant.domain'];
        $data = $this->tenantDetailService->getAll($request, $relations);
    } catch (Exception $e) {
        Log::error($e->getMessage());
        return $this->errorResponse('Something went wrong', 500);
    }

    return $this->successResponse(
        TenantDetailResource::collection($data),
        'TenantDetail data retrieved successfully'
    );
}

/**
 * @OA\Post(
 *     path="/api/tenantdetails",
 *     summary="Create TenantDetail",
 *     operationId="storeTenantDetail",
 *     tags={"tenantdetails"},
 *     @OA\RequestBody(
 *         required=true,
 *         @OA\JsonContent(ref="#/components/schemas/TenantDetailCreateSchema")
 *     ),
 *     @OA\Response(
 *         response=201,
 *         description="TenantDetail created"
 *     )
 * )
 */
public function store(TenantDetailRequest $request)
{
    try {
        $dto = TenantDetailDataBuilder::getDtoData($request);
        $data = $this->tenantDetailService->store($dto);
    } catch (Exception $e) {
        dd($e);
        Log::error($e->getMessage());
        return $this->errorResponse('Something went wrong', 500);
    }

    return $this->successResponse(
        new TenantDetailResource($data),
        'TenantDetail created successfully',
        201
    );
}

/**
 * @OA\Get(
 *     path="/api/tenantdetails/{id}",
 *     summary="Get TenantDetail by ID",
 *     operationId="getTenantDetailById",
 *     tags={"tenantdetails"},
 *     @OA\Parameter(
 *         name="id",
 *         in="path",
 *         required=true,
 *         @OA\Schema(type="integer")
 *     ),
 *     @OA\Response(
 *         response=201,
 *         description="TenantDetail Fetch"
 *     )
 * )
 */
public function show($id)
{
    try {
        $data = $this->tenantDetailService->findById($id);
    } catch (Exception $e) {
        Log::error($e->getMessage());
        return $this->errorResponse('Something went wrong', 500);
    }

    return $this->successResponse(
        new TenantDetailResource($data),
        'TenantDetail retrieved successfully'
    );
}

/**
 * @OA\Patch(
 *     path="/api/tenantdetails/{id}",
 *     summary="Update TenantDetail",
 *     operationId="updateTenantDetail",
 *     tags={"tenantdetails"},
 *     @OA\Response(
 *         response=201,
 *         description="TenantDetail update"
 *     )
 * )
 */
public function update(TenantDetailRequest $request, $id)
{
    try {
        $dto = TenantDetailDataBuilder::getDtoData($request);
        $data = $this->tenantDetailService->update($dto, $id);
    } catch (Exception $e) {
        Log::error($e->getMessage());
        return $this->errorResponse('Something went wrong', 500);
    }

    return $this->successResponse(
        $data,
        'TenantDetail updated successfully'
    );
}

/**
 * @OA\Delete(
 *     path="/api/tenantdetails/{id}",
 *     summary="Delete TenantDetail",
 *     operationId="deleteTenantDetail",
 *     tags={"tenantdetails"},
 *     @OA\Response(
 *         response=204,
 *         description="TenantDetail Delete"
 *     )
 * )
 */
public function destroy($id)
{
    try {
        $this->tenantDetailService->delete($id);
    } catch (Exception $e) {
        Log::error($e->getMessage());
        return $this->errorResponse('Something went wrong', 500);
    }

    return $this->successResponse(null, 'tenant_details deleted successfully', 204);
}
/**
 * @OA\Patch(
 *     path="/api/tenantdetails/tenants/{id}/activate",
 *     summary="Activate tenant",
 *     tags={"Tenant"},
 *     @OA\Parameter(
 *         name="id",
 *         in="path",
 *         required=true,
 *         @OA\Schema(type="string")
 *     ),
 *     @OA\Response(
 *         response=200,
 *         description="Tenant activated successfully"
 *     )
 * )
 */

}


### Service layer Class
class TenantDetailService

{

public function __construct(
    public TenantDetailInterface $tenantDetailInterface,
) {}

public function getAll($request, $eagerLoadWithRelationData = [])
{
    try {
        $pagination = $request->boolean('pagination');
        $paginationNumber = $pagination ? 10 : null;

        return $this->tenantDetailInterface
            ->getAll(
                pagination: $pagination,
                paginate: $paginationNumber,
                withRelations: $eagerLoadWithRelationData
            );
    } catch (Exception $exception) {
        throw $exception;
    }
}
public function store(TenantDetailDTO $dto): TenantDetail
{
    try {
        DB::beginTransaction();

        $data = [
            'tenant_id' =>$tenant->id,
            'country_id' => $dto->country_id,
            'database_name' => $dto->database_name,
            'currency' => $dto->currency,
            'language' => $dto->language,
            'timezone' => $dto->timezone,
            'primary_email' => $dto->primary_email,
            'local_tin_number' => $dto->local_tin_number,
        ];

        $modelData = $this->tenantDetailInterface->create($data);
        $tenant->domain()->create([
            'domain' => $dto->domain,
        ]);
    } catch (Exception $exception) {
        DB::rollback();
        throw new Exception($exception);
    }
    DB::commit();

    return $modelData;
}

public function findById(int $id): TenantDetail
{
    try {
        $modelData = $this->tenantDetailInterface->getById($id);
    } catch (Exception $exception) {
        throw new Exception($exception);
    }

    return $modelData;
}

public function update(TenantDetailDTO $dto, $id)
{
    try {
        DB::beginTransaction();
        $data = [
            'country_id' => $dto->country_id,
            'currency' => $dto->currency,
            'language' => $dto->language,
            'timezone' => $dto->timezone,
            'primary_email' => $dto->primary_email,
            'local_tin_number' => $dto->local_tin_number,
        ];

        $modelData = $this->tenantDetailInterface->update($id, $data);
    } catch (Exception $exception) {
        DB::rollBack();
        throw new Exception($exception);
    }
    DB::commit();

    return $modelData;
}

public function delete($id): bool
{
    try {
        DB::beginTransaction();
        $this->tenantDetailInterface->delete($id);
    } catch (Exception $exception) {
        DB::rollBack();
        throw new Exception($exception);
    }
    DB::commit();

    return true;
}

}



santoshghimire/crud-generator 适用场景与选型建议

santoshghimire/crud-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 santoshghimire/crud-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 santoshghimire/crud-generator 我们能提供哪些服务?
定制开发 / 二次开发

基于 santoshghimire/crud-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-02-05