victormgomes/rest-messages 问题修复 & 功能扩展

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

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

victormgomes/rest-messages

最新稳定版本:0.0.3

Composer 安装命令:

composer require victormgomes/rest-messages

包简介

Standardized message responses for REST resources

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads License

Standardized message responses for REST resources

Introduction

Rest Messages is a lightweight package designed to standardize success messages across your Laravel REST API. It automatically detects the model name and the current CRUD action (index, store, update, destroy) to generate localized and professional response messages.

Why use this package?

  • Consistency: Ensure every success response in your API follows the same linguistic pattern.
  • Automatic Detection: No need to manually type messages for every controller action. The package "just knows" what you're doing.
  • Localized: Built-in support for multiple languages with proper grammar and gender resolution for model names.
  • Clean API: Focus on your data, while the package handles the communication part of your REST interface.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by sponsoring us on GitHub.

Installation

You can install the package via composer:

composer require victormgomes/rest-messages

Usage

Simply use the HasResourceMessages trait in your response helpers or base controllers.

use Victormgomes\RestMessages\Traits\HasResourceMessages;

class ApiResponse
{
    use HasResourceMessages;

    public function success($data)
    {
        return response()->json([
            'message' => $this->message(),
            'data' => $data,
        ]);
    }
}

The $this->message() method will automatically resolve the model and action from the current route context. For example, if called from UserController@store, it will return: "User created successfully."

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固