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: README.md
+19-17
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@
38
38
39
39
This package integrates the Symfony Serializer component into Laravel, providing a powerful tool for serializing and deserializing objects into various formats such as JSON, XML, CSV, and YAML.
40
40
41
-
Detailed documentation on the Symfony serializer can be found on their [official page](https://symfony.com/doc/current/components/serializer.html).
41
+
Detailed documentation on the Symfony Serializer can be found on their [official page](https://symfony.com/doc/current/components/serializer.html).
42
42
43
43
<br>
44
44
@@ -52,7 +52,7 @@ Detailed documentation on the Symfony serializer can be found on their [official
52
52
-[Usage](#-usage)
53
53
-[Components](#-components)
54
54
-[Example DTO](#-example-dto)
55
-
-[Using `SerializerManager` in your Service Classes](#-using-serializermanager-in-your-service-classes)
55
+
-[Using `SerializerManager` in your Service Classes](#-using-serializermanager-in-service-classes)
56
56
-[Using `ResponseFactory` in Laravel Controllers](#-using-responsefactory-in-laravel-controllers)
57
57
-[Using in Laravel Queues](#-using-in-laravel-queues)
58
58
-[Security Policy](#-security-policy)
@@ -62,11 +62,13 @@ Detailed documentation on the Symfony serializer can be found on their [official
62
62
-[License](#-license)
63
63
-[Credits and Useful Resources](#-credits-and-useful-resources)
64
64
65
+
<br>
66
+
65
67
## 🤔 Purpose
66
68
67
-
This package brings the power of the Symfony Serializer component to Laravel. While Laravel does not have a built-in serializer and typically relies on array or JSON transformations, this package provides more advanced serialization capabilities. This includes object normalization, handling of circular references, property grouping, and format-specific encoders.
69
+
This package brings the power of the Symfony Serializer component to Laravel. While Laravel does not have a built-in serializer and typically relies on array or JSON transformations, this package provides more advanced serialization capabilities. These include object normalization, handling of circular references, property grouping, and format-specific encoders.
68
70
69
-
If you are building a REST API, working with queues, or have complex serialization needs, this package will be especially useful. It allows you to use objects as payload instead of simple arrays, and supports various formats such as JSON, XML, CSV, and YAML. This documentation will guide you through the installation process and provide examples of how to use the package to serialize and deserialize your objects.
71
+
If you are building a REST API, working with queues, or have complex serialization needs, this package will be especially useful. It allows you to use objects as payloads instead of simple arrays and supports various formats such as JSON, XML, CSV, and YAML. This documentation will guide you through the installation process and provide examples of how to use the package to serialize and deserialize your objects.
70
72
71
73
<br>
72
74
@@ -76,10 +78,10 @@ If you are building a REST API, working with queues, or have complex serializati
-**`default`**: Specifies the default serializer format. This can be overridden by setting the `SERIALIZER_DEFAULT_FORMAT`environment variable. The default is `symfony-json`.
138
+
-**`default`**: Specifies the default serializer format. This can be overridden by setting the `SERIALIZER_DEFAULT_FORMAT`environment variable. The default is `symfony-json`.
137
139
-**`debug`**: Enables debug mode for `ProblemNormalizer`. This can be set using the `SERIALIZER_DEBUG_MODE` environment variable. It defaults to the `APP_DEBUG` value.
138
140
-**`normalizerRegistrationStrategy`**: Specifies the strategy class for registering normalizers. The default strategy is [`WayOfDev\Serializer\DefaultNormalizerRegistrationStrategy`](https://github.com/wayofdev/laravel-symfony-serializer/blob/master/src/DefaultNormalizerRegistrationStrategy.php).
139
141
-**`encoderRegistrationStrategy`**: Specifies the strategy class for registering encoders. The default strategy is [`WayOfDev\Serializer\DefaultEncoderRegistrationStrategy`](https://github.com/wayofdev/laravel-symfony-serializer/blob/master/src/DefaultEncoderRegistrationStrategy.php).
@@ -147,7 +149,7 @@ You can create custom normalizer or encoder registration strategies by implement
147
149
148
150
#### Normalizer Registration Strategy
149
151
150
-
To create a custom normalizer registration strategy
152
+
To create a custom normalizer registration strategy:
151
153
152
154
1. Implement the [`NormalizerRegistrationStrategy`](https://github.com/wayofdev/laravel-symfony-serializer/blob/master/src/Contracts/NormalizerRegistrationStrategy.php) interface:
153
155
@@ -245,7 +247,7 @@ The default serializers available in this package are: `symfony-json`, `symfony-
245
247
246
248
> [!WARNING]
247
249
> The `yaml` encoder requires the `symfony/yaml` package and is disabled when the package is not installed.
248
-
> Install the `symfony/yaml` package and the encoder will be automatically enabled.
250
+
> Install the `symfony/yaml` package, and the encoder will be automatically enabled.
249
251
250
252
### → Components
251
253
@@ -261,8 +263,8 @@ The `ResponseFactory` is used to create responses in Laravel controllers, making
261
263
262
264
This package includes two Laravel Facades:
263
265
264
-
-`Manager` — To access underlying SerializerManager
265
-
-`Serializer` — To access bound and configured original Symfony Serializer instance.
266
+
-`Manager` — To access the underlying `SerializerManager`
267
+
-`Serializer` — To access the bound and configured original Symfony Serializer instance.
266
268
267
269
### → Example DTO
268
270
@@ -314,7 +316,7 @@ class UserDTO
314
316
}
315
317
```
316
318
317
-
### → Using `SerializerManager` in your Service Classes
319
+
### → Using `SerializerManager` in Service Classes
$dto = new UserDTO(1, 'John Doe', 'john@example.com');
338
340
339
341
$serialized = $serializer->serialize(
@@ -443,14 +445,14 @@ This project has a [security policy](.github/SECURITY.md).
443
445
444
446
## 🙌 Want to Contribute?
445
447
446
-
Thank you for considering contributing to the wayofdev community! We are open to all kinds of contributions. If you want to:
448
+
Thank you for considering contributing to the wayofdev community! We welcome all kinds of contributions. If you want to:
447
449
448
450
- 🤔 [Suggest a feature](https://github.com/wayofdev/laravel-symfony-serializer/issues/new?assignees=&labels=type%3A+enhancement&projects=&template=2-feature-request.yml&title=%5BFeature%5D%3A+)
449
451
- 🐛 [Report an issue](https://github.com/wayofdev/laravel-symfony-serializer/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=1-bug-report.yml&title=%5BBug%5D%3A+)
0 commit comments