You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+23-9Lines changed: 23 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,28 @@
1
1
# Changelog
2
2
3
-
## [released]
4
-
3
+
## [3.0.0] - 2025-03-11
5
4
### Added
6
-
- Initial release of `uxmansarwar/response`.
7
-
- Added result and error storage.
8
-
- JSON, array, response support.
9
-
- User input handling.
5
+
-**PHPStan Compliant Developer Comments**: Added detailed PHPStan-compliant comments to improve code readability and maintainability.
6
+
-**`collection()` Method**: Introduced a new method to centralize response data collection, reducing redundancy in `json()` and `array()`.
7
+
-**Static Response Key Names**: Defined `$result_key_text`, `$error_key_text`, and `$input_key_text` as static class properties for better maintainability.
10
8
11
-
## [1.0.0] - 2025-02-20
9
+
### Changed
10
+
-**Singleton Handling**: Improved `singleton()` method for better reusability instead of initializing in multiple places.
11
+
-**Constructor Reset Behavior**: Adjusted constructor logic to ensure that each instantiation resets response states correctly.
12
+
-**JSON Parsing Validation**: Enhanced JSON request body parsing by verifying `json_last_error()`.
13
+
-**Better Result & Error Storage**: Updated result and error storage to always ensure correct structuring when using keys.
14
+
15
+
### Fixed
16
+
-**Incorrect Singleton Reinitialization**: Ensured `singleton()` and `init()` methods correctly maintain a single instance.
17
+
-**Input Handling Edge Cases**: Addressed cases where JSON input merging could fail under certain request formats.
18
+
-**Return Consistency**: Standardized method return values to always return `self` where applicable for method chaining.
19
+
20
+
---
21
+
22
+
## [2.0.1] - Previous Version
23
+
### Initial Features
24
+
- Implemented Singleton pattern.
25
+
- Added methods for storing results (`result()`) and errors (`error()`).
26
+
- Supported response output in both JSON (`json()`) and array (`array()`) formats.
27
+
- Allowed toggling of user input inclusion in responses via `input()` method.
Response is a PHP class designed to manage API responses efficiently. It provides a singleton-based approach to storing and retrieving results, errors, and user input data in multiple formats (JSON, array). This class ensures proper handling of API responses while maintaining PHP 7+ compatibility.
- Capture user input from `$_GET`, `$_POST`, and JSON payloads.
9
-
- Retrieve stored data in JSON, array, format.
10
-
- Support for enabling/disabling user input inclusion in responses.
11
-
- Works on PHP 7 and above.
7
+
## Overview
8
+
9
+
`Response` is a **lightweight PHP library** designed to streamline **API response handling**. It follows a **singleton-based pattern** to store and retrieve results, errors, and user input efficiently. The package is **PSR-4 compliant** and fully compatible with **PHP 7.2+ and PHP 8.2**.
10
+
11
+
### **Key Features**
12
+
- ✅ **Singleton pattern** to prevent redundant object creation.
13
+
- ✅ **Structured response handling** for JSON and array outputs.
14
+
- ✅ **Collect API results & errors dynamically**.
15
+
- ✅ **Retrieve user input** from `$_GET`, `$_POST`, and JSON payloads.
16
+
- ✅ **Flexible data retrieval** (JSON, array, collection format).
17
+
- ✅ **Works with Laravel, Symfony, CodeIgniter, WordPress, and Core PHP**.
0 commit comments