jeevanjoshi/laravel-api-response 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

jeevanjoshi/laravel-api-response

最新稳定版本:v1.0.0

Composer 安装命令:

composer require jeevanjoshi/laravel-api-response

包简介

A simple and elegant API response formatter for Laravel

README 文档

README

A simple and elegant API response formatter for Laravel.

Installation

composer require jeevanjoshi/laravel-api-response

The package will be auto-discovered by Laravel. No manual configuration needed.

Usage

use ApiResponse;

// Success response (200)
return ApiResponse::success($data, 'Users fetched');

// Created response (201)
return ApiResponse::created($data, 'User created');

// Paginated response (200)
return ApiResponse::paginated($users);

// Error response (500)
return ApiResponse::error('Something went wrong');

// Not found response (404)
return ApiResponse::notFound('User not found');

// Unauthorized response (401)
return ApiResponse::unauthorized();

// Forbidden response (403)
return ApiResponse::forbidden();

// Validation error response (422)
return ApiResponse::validation($errors);

// No content response (200)
return ApiResponse::noContent();

Response Structure

Success

{
    "success": true,
    "message": "Users fetched",
    "data": {}
}

Error

{
    "success": false,
    "message": "Something went wrong",
    "errors": null
}

Paginated

{
    "success": true,
    "message": "Success",
    "data": [],
    "meta": {
        "current_page": 1,
        "last_page": 5,
        "per_page": 15,
        "total": 75
    }
}

Validation

{
    "success": false,
    "message": "Validation failed",
    "errors": {
        "email": ["The email field is required"]
    }
}

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固