Skip to content

Commit 1f19892

Browse files
authored
Merge pull request #208 from wayofdev/feat/updates
2 parents f3cba9f + ea23edb commit 1f19892

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

README.md

+19-17
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
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.
4040

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).
4242

4343
<br>
4444

@@ -52,7 +52,7 @@ Detailed documentation on the Symfony serializer can be found on their [official
5252
- [Usage](#-usage)
5353
- [Components](#-components)
5454
- [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)
5656
- [Using `ResponseFactory` in Laravel Controllers](#-using-responsefactory-in-laravel-controllers)
5757
- [Using in Laravel Queues](#-using-in-laravel-queues)
5858
- [Security Policy](#-security-policy)
@@ -62,11 +62,13 @@ Detailed documentation on the Symfony serializer can be found on their [official
6262
- [License](#-license)
6363
- [Credits and Useful Resources](#-credits-and-useful-resources)
6464

65+
<br>
66+
6567
## 🤔 Purpose
6668

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.
6870

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.
7072

7173
<br>
7274

@@ -76,10 +78,10 @@ If you are building a REST API, working with queues, or have complex serializati
7678

7779
## 💿 Installation
7880

79-
Require as dependency:
81+
Require the package as a dependency:
8082

8183
```bash
82-
composer req wayofdev/laravel-symfony-serializer
84+
composer require wayofdev/laravel-symfony-serializer
8385
```
8486

8587
You can publish the config file with:
@@ -133,7 +135,7 @@ return [
133135

134136
### → Configuration Options
135137

136-
- **`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`.
137139
- **`debug`**: Enables debug mode for `ProblemNormalizer`. This can be set using the `SERIALIZER_DEBUG_MODE` environment variable. It defaults to the `APP_DEBUG` value.
138140
- **`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).
139141
- **`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
147149

148150
#### Normalizer Registration Strategy
149151

150-
To create a custom normalizer registration strategy
152+
To create a custom normalizer registration strategy:
151153

152154
1. Implement the [`NormalizerRegistrationStrategy`](https://github.com/wayofdev/laravel-symfony-serializer/blob/master/src/Contracts/NormalizerRegistrationStrategy.php) interface:
153155

@@ -245,7 +247,7 @@ The default serializers available in this package are: `symfony-json`, `symfony-
245247

246248
> [!WARNING]
247249
> 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.
249251
250252
### → Components
251253

@@ -261,8 +263,8 @@ The `ResponseFactory` is used to create responses in Laravel controllers, making
261263

262264
This package includes two Laravel Facades:
263265

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.
266268

267269
### → Example DTO
268270

@@ -314,7 +316,7 @@ class UserDTO
314316
}
315317
```
316318

317-
### → Using `SerializerManager` in your Service Classes
319+
### → Using `SerializerManager` in Service Classes
318320

319321
```php
320322
<?php
@@ -324,7 +326,7 @@ namespace Application\Services;
324326
use WayOfDev\Serializer\Manager\SerializerManager;
325327
use Application\User\UserDTO;
326328

327-
class MyService
329+
class ProductService
328330
{
329331
public function __construct(
330332
private readonly SerializerManager $serializer,
@@ -333,7 +335,7 @@ class MyService
333335

334336
public function someMethod(): void
335337
{
336-
$serializer = $serializer->serializer('symfony-json');
338+
$serializer = $this->serializer->serializer('symfony-json');
337339
$dto = new UserDTO(1, 'John Doe', 'john@example.com');
338340

339341
$serialized = $serializer->serialize(
@@ -443,14 +445,14 @@ This project has a [security policy](.github/SECURITY.md).
443445

444446
## 🙌 Want to Contribute?
445447

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:
447449

448450
- 🤔 [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+)
449451
- 🐛 [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+)
450452
- 📖 [Improve documentation](https://github.com/wayofdev/laravel-symfony-serializer/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=4-docs-bug-report.yml&title=%5BDocs%5D%3A+)
451453
- 👨‍💻 [Contribute to the code](.github/CONTRIBUTING.md)
452454

453-
You are more than welcome. Before contributing, kindly check our [contribution guidelines](.github/CONTRIBUTING.md).
455+
You are more than welcome. Before contributing, please check our [contribution guidelines](.github/CONTRIBUTING.md).
454456

455457
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=for-the-badge)](https://conventionalcommits.org)
456458

@@ -475,7 +477,7 @@ You are more than welcome. Before contributing, kindly check our [contribution g
475477

476478
## 📜 License
477479

478-
[![Licence](https://img.shields.io/github/license/wayofdev/laravel-symfony-serializer?style=for-the-badge&color=blue)](./LICENSE.md)
480+
[![License](https://img.shields.io/github/license/wayofdev/laravel-symfony-serializer?style=for-the-badge&color=blue)](./LICENSE.md)
479481

480482
<br>
481483

0 commit comments

Comments
 (0)