https://github.com/attributes-php/options
A collection of Attributes to enhance the validation/serialization stages
https://github.com/attributes-php/options
enhance serialization validation
Last synced: 5 months ago
JSON representation
A collection of Attributes to enhance the validation/serialization stages
- Host: GitHub
- URL: https://github.com/attributes-php/options
- Owner: Attributes-PHP
- License: mit
- Created: 2025-06-13T16:07:14.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-24T07:45:50.000Z (12 months ago)
- Last Synced: 2025-09-02T10:58:29.230Z (10 months ago)
- Topics: enhance, serialization, validation
- Language: PHP
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Attributes Options
**Attributes Options** is a collection of Attributes that can be used to enhance the [validation](https://github.com/Attributes-PHP/validation)
and/or [serialization](https://github.com/Attributes-PHP/serializer) stages.
## Supported options
### Class specific options
- *AliasGenerator*, generates an alias per each class property
### Property options
- *Alias*, specifies a given alias for a property
- *Ignore*, skips the validation and/or serialization of a property
## Requirements
- PHP 8.1+
We aim to support versions that haven't reached their end-of-life.
## How it works?
```php
'user',
'password' => '1234',
];
// Validation stage
$validator = new Validator();
$login = $validator->validate($rawData, new Login);
var_dump($login->user); // string(4) "user
var_dump($login->password); // string(4) "1234"
// Serialization stage
$serializer = new Serializer;
$serializedData = $serializer->serialize($login);
var_dump($serializedData); // array { ["user_name"] => "user" }
```
## Installation
```bash
composer require attributes-php/options
```
Attributes Options was created by **[André Gil](https://www.linkedin.com/in/andre-gil/)** and is open-sourced software licensed under the **[MIT license](https://opensource.org/licenses/MIT)**.