PHPackages                             redoy/core-module - 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. [API Development](/categories/api)
4. /
5. redoy/core-module

ActiveLibrary[API Development](/categories/api)

redoy/core-module
=================

Lightweight Laravel package providing standardized JSON response handling and HTTP status code constants for modern API development

1.0.0(5mo ago)06MITPHPPHP ^8.2

Since Dec 4Pushed 5mo agoCompare

[ Source](https://github.com/Redoykumar/laravel-core-module)[ Packagist](https://packagist.org/packages/redoy/core-module)[ Docs](https://github.com/redoy/core-module)[ RSS](/packages/redoy-core-module/feed)WikiDiscussions Main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Redoy CoreModule
================

[](#redoy-coremodule)

A lightweight Laravel package that provides standardized JSON response handling and HTTP status code constants for modern API development.

Features
--------

[](#features)

- **ResponseHelperTrait**: Unified interface for success and error responses with consistent JSON formatting
- **ApiCodes**: Comprehensive HTTP status code constants (1xx, 2xx, 3xx, 4xx, 5xx)
- **JSON Response Builder Integration**: Built on top of the `marcin-orlowski/response-builder` package for flexible response construction
- **Type-safe Status Codes**: Named constants for all standard HTTP status codes (e.g., `ApiCodes::OK`, `ApiCodes::NOT_FOUND`)
- **Flexible Data &amp; Messaging**: Support for custom data, error objects, and messages in responses

Installation
------------

[](#installation)

1. **Via Composer** (when package is published):

    ```
    composer require redoy/core-module
    ```
2. **Local Development**:

    ```
    # Clone or link the package into packages/Redoy/CoreModule
    composer dump-autoload
    ```
3. **Register Service Provider** (Auto-registered, but manual if needed):

    ```
    php artisan package:discover
    ```
4. **Publish Package Assets** (Configuration &amp; Language Files):

    ```
    php artisan vendor:publish --provider="Redoy\CoreModule\Providers\CoreModuleServiceProvider"
    ```

    This will publish:

    - **Configuration**: `config/core.php`, `config/response_builder.php`
    - **Language Files**: `resources/lang/en/api.php`, `resources/lang/bn/api.php`
5. **Optional - Publish Only Configuration**:

    ```
    php artisan vendor:publish --provider="Redoy\CoreModule\Providers\CoreModuleServiceProvider" --tag="config"
    ```
6. **Optional - Publish Only Language Files**:

    ```
    php artisan vendor:publish --provider="Redoy\CoreModule\Providers\CoreModuleServiceProvider" --tag="lang"
    ```

Quick Start
-----------

[](#quick-start)

### Using ResponseHelperTrait

[](#using-responsehelpertrait)

Add the trait to any class (Controller, Service, etc.):

```
