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
Welcome to the <strong>Laravel API Response Builder</strong>! This package simplifies the creation of structured and formatted API responses in both JSON and XML formats. It provides customizable status codes, messages, and data handling, making it a versatile tool for managing API responses, including error handling, logging, and extensive configuration options.
7
+
<strong>Simplify Your API Responses with Laravel API Response Builder!</strong> This package helps you create structured and formatted API responses in both JSON and XML formats effortlessly. It provides customizable status codes, messages, and data handling, making it a versatile tool for managing API responses, including error handling, logging, and extensive configuration options.
15
8
</p>
16
9
17
10
## 📚 Index
18
11
19
-
-[Installation](#installation)
20
-
-[Technologies](#technologies)
21
-
-[Concepts & Patterns](#concepts--patterns)
22
-
-[Prerequisites](#prerequisites)
23
-
-[Documentation](#documentation)
24
-
-[Links](#links)
25
-
-[Contributing](#contributing)
26
-
-[License](#license)
27
-
-[Contact](#contact)
12
+
-[Features](#-features)
13
+
-[Requirements](#-requirements)
14
+
-[Installation](#-installation)
15
+
-[Translations](#-translations)
16
+
-[Technologies](#-technologies)
17
+
-[Concepts & Patterns](#-concepts--patterns)
18
+
-[Documentation](#-documentation)
19
+
-[Links](#-links)
20
+
-[Contributing](#-contributing)
21
+
-[License](#-license)
22
+
-[Contact](#-contact)
28
23
29
24
## 🚀 Features
30
25
@@ -33,39 +28,61 @@
33
28
-**Error Handling & Logging:** Detailed logging for both responses and requests.
34
29
-**Flexible Configuration:** Adjust settings for data wrapping, response languages, and more.
35
30
36
-
## ⚙️ Prerequisites
31
+
## ⚙️ Requirements
37
32
38
33
Ensure your project meets the following requirements before using this package:
39
34
40
35
-**Laravel Framework:** Version 8.12 or higher.
41
36
-**PHP:** Version 7.3 or higher.
42
37
-**Composer:** PHP dependency manager.
43
38
39
+
With these features in place, let’s dive into the installation process!
40
+
44
41
## 📦 Installation
45
42
46
43
To integrate the Laravel API Response Builder into your Laravel project, follow these steps:
This will create a configuration file at `config/responsebuilder.php` where you can customize the package settings.
61
+
This will create a configuration file at `config/responsebuilder.php`, where you can customize the package settings.
65
62
66
63
3.**Configuration:**
67
64
68
-
Open the `config/responsebuilder.php` file and adjust the settings as needed for your project. Configure options such as data wrappers, API key headers, and logging preferences.
65
+
Open the `config/responsebuilder.php` file and adjust the settings as needed for your project. Configure options such as data wrappers, API key headers, and logging preferences.
66
+
67
+
With the configuration in place, your package is ready to go!
68
+
69
+
## 🌍 Translations
70
+
71
+
The **Laravel API Response Builder** supports multiple languages for API responses. By default, it includes English (`en`) and Brazilian Portuguese (`pt_BR`). To use translations in your project, follow these steps:
72
+
73
+
1.**Publish the Translation Files (Optional):**
74
+
75
+
If you wish to customize or add new languages, you can publish the translation files to your project by running:
76
+
77
+
```bash
78
+
php artisan vendor:publish --tag=lang
79
+
```
80
+
81
+
This will create a `resources/lang/vendor/responsebuilder` directory where you can modify or add new translation files (e.g., `es`, `fr`).
82
+
83
+
2.**Use Existing Translation Files:**
84
+
85
+
If you do not need custom translations, the package will automatically use the default language files from the `vendor/doliveira/laravel-api-response-builder/resources/lang` directory.
69
86
70
87
## 🧰 Technologies
71
88
@@ -77,10 +94,6 @@ The **Laravel API Response Builder** utilizes the following technologies:
77
94
-**XML:** Data format for API responses (currently under development).
78
95
-**Log:** Laravel's logging facilities for recording response details.
79
96
80
-
Claro, aqui está uma versão aprimorada para a seção "Concepts & Patterns", baseada no código e na funcionalidade descrita:
81
-
82
-
---
83
-
84
97
## 📚 Concepts & Patterns
85
98
86
99
The **Laravel API Response Builder** package integrates several advanced concepts and patterns designed to enhance API response management:
@@ -89,42 +102,48 @@ The **Laravel API Response Builder** package integrates several advanced concept
89
102
90
103
-**Detailed Logging:** The package offers comprehensive logging capabilities for both responses and requests. Using Laravel’s built-in logging facilities, it captures key details such as response status, headers, and content. This feature supports various logging levels and allows you to specify log file paths, enabling efficient debugging and monitoring of your API interactions.
91
104
105
+
_Example: You can view response logs in your designated log file, set in the configuration file under `logging.channels`. For instance, responses with status codes `500` will be logged as errors, helping you track and debug critical issues._
106
+
92
107
-**Flexible Configuration Management:** Leveraging Laravel’s configuration system, the package provides extensive options for customizing the response structure. You can easily configure data wrappers, API key headers, default status codes, and response languages. This flexibility allows you to tailor the package’s behavior to fit the specific needs of your project.
93
108
94
109
-**Standardized Error Handling:** The package standardizes the way error messages and statuses are generated. It provides a consistent approach to error responses, allowing for easier troubleshooting and improved user experience. Configuration options are available to adjust error message formats and response codes, ensuring that error handling aligns with your application’s requirements.
To contribute to the development of this package, please fork the repository and submit a pull request.
146
+
You can contribute by forking the repository and submitting a pull request.
128
147
129
148
## 📝 License
130
149
@@ -139,4 +158,4 @@ For any questions or feedback, please reach out to:
139
158
140
159
---
141
160
142
-
**Note:** This package is currently under development, and XML support is still in progress. As an early release, there might be bugs or incomplete features. We appreciate your patience and feedback.
161
+
**Note:** This package is currently under development, and XML support is still in progress. As an early release, there might be bugs or incomplete features. We appreciate your patience and feedback.
0 commit comments