定制 sobhan-aali/laravel-apiresponse 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

sobhan-aali/laravel-apiresponse

最新稳定版本:v1.0.1

Composer 安装命令:

composer require sobhan-aali/laravel-apiresponse

包简介

A Laravel package to standardize JSON API responses and centralize exception handling

README 文档

README

👋 Introduction

Hi, I'm Sobhan Aali — thank you for choosing this package!

This package helps you standardize all your API JSON responses and handle exceptions gracefully across your Laravel project, including:

  • ✅ Consistent and customizable API Response formatting

  • ✅ Centralized Exception handling with meaningful JSON outputs

  • ✅ Easy-to-use Traits and response classes to speed up development

Installation:

composer require sobhan-aali/laravel-apiresponse

What’s Next?

Two files will be automatically created for you to customize:

  • Responses/ApiResponse.php

  • Traits/Exceptions.php

How to Enable Exception Handling

Add the following code to your bootstrap/app.php file to automatically handle exceptions using the package’s trait:

use App\Helpers\Exceptions;

$app->withExceptions(function ($exceptions) {
    
    $exceptions->renderable(function (Throwable $exception, $request) use ($handler) {
        return Exceptions::render($exception, $request);
    });
});

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-11