Download the PHP package redoy/core-module without Composer
On this page you can find all versions of the php package redoy/core-module. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download redoy/core-module
More information about redoy/core-module
Files in redoy/core-module
Package core-module
Short Description Lightweight Laravel package providing standardized JSON response handling and HTTP status code constants for modern API development
License MIT
Homepage https://github.com/redoy/core-module
Informations about the package core-module
Redoy CoreModule
A lightweight Laravel package that provides standardized JSON response handling and HTTP status code constants for modern API development.
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-builderpackage 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 & Messaging: Support for custom data, error objects, and messages in responses
Installation
-
Via Composer (when package is published):
-
Local Development:
-
Register Service Provider (Auto-registered, but manual if needed):
-
Publish Package Assets (Configuration & Language Files):
This will publish:
- Configuration:
config/core.php,config/response_builder.php - Language Files:
resources/lang/en/api.php,resources/lang/bn/api.php
- Configuration:
-
Optional - Publish Only Configuration:
- Optional - Publish Only Language Files:
Quick Start
Using ResponseHelperTrait
Add the trait to any class (Controller, Service, etc.):
Using ApiCodes
Reference any HTTP status code via named constants:
Project Structure
Requirements
- PHP: 8.2+
- Laravel: 11.0+
- Dependencies:
marcin-orlowski/response-builder(for JSON response building)illuminate/http(for JsonResponse)
Documentation
- API Reference — Full method signatures, parameters, and return types
- Usage Examples — Practical code examples and patterns
- Testing Guide — How to run tests and understand test coverage
- Test Reports — Automated test execution reports (HTML, JUnit XML)
Testing
Run all tests:
Run specific test file:
Generate test reports:
View test reports:
- HTML Report: Open
packages/Redoy/CoreModule/tests/report/testdox.htmlin a browser - JUnit XML: Available at
packages/Redoy/CoreModule/tests/report/junit.xmlfor CI/CD integration
Test Coverage
- Unit Tests: 34 tests covering ResponseHelperTrait methods, ApiCodes constants, and JSON encoding/decoding
- JSON-Driven Tests: 20 comprehensive test cases covering:
- Valid success and error responses
- Nested and complex data structures
- Unicode and special characters
- Edge cases (empty arrays, null values, mixed types)
- Exception handling (invalid status codes, type errors)
Overall: 35 tests with 129 assertions, all passing ✓
Common Response Patterns
Success Response
Error Response
No Content (204)
Created Resource (201)
License
This package is part of the EnterpriseApp project.
Contributing
- Write tests for any new functionality (in
tests/Unit/) - Ensure all tests pass:
./vendor/bin/phpunit packages/Redoy/CoreModule/tests - Update documentation in
docs/as needed - Regenerate test reports before committing
Support
For issues, questions, or contributions, please refer to the project's main repository.
All versions of core-module with dependencies
marcin-orlowski/laravel-api-response-builder Version ^12.1.1
illuminate/http Version ^11.0 || ^12.0