Skip to content

Commit b96d90d

Browse files
committed
parameter 2.0
1 parent 3706ba0 commit b96d90d

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

packages/parameter.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
**Chevere Parameter** is a library for building dynamic, validated parameters with type-safe rules and schema introspection. It enables you to define rich validation constraints for any PHP type, from simple scalars to deeply nested arrays, using either helper functions or attributes, eliminating boilerplate validation logic across your codebase.
66

7-
See [chevere/action](https://github.com/chevere/action) for our object-oriented convention around this package.
7+
* **[chevere/action](https://chevere.org/packages/action)**: Implements the action design pattern for encapsulating business logic, utilizing this package for comprehensive parameter validation.
8+
* **[chevere/router](https://chevere.org/packages/router)**: Offers powerful routing with built-in parameter validation for handling HTTP requests and responses.
9+
* **[chevere/sql2p](https://chevere.org/packages/sql2p)**: Transforms SQL queries into parameter definitions, enabling automated validation of database inputs and outputs.
810

911
## Installing
1012

@@ -195,20 +197,19 @@ Common methods available on all parameters:
195197

196198
```php
197199
$parameter->withDescription('A human-readable label');
198-
$parameter->withIsSensitive(); // marks value as sensitive (omitted from error messages)
200+
$parameter->withIsSensitive(true); // marks value as sensitive (omitted from error messages)
201+
$parameter->withDefault($defaultValue); // sets a default value used when the parameter is optional and not provided
199202
```
200203

201204
Methods specific to each parameter type:
202205

203-
| Parameter | Immutable methods |
204-
| ------------------- | ---------------------------------------------------------------------------------------------------------------------- |
205-
| `IntParameter` | `withMin`, `withMax`, `withAccept`, `withReject`, `withDefault` |
206-
| `FloatParameter` | `withMin`, `withMax`, `withAccept`, `withReject`, `withDefault` |
207-
| `StringParameter` | `withRegex`, `withDefault` |
208-
| `BoolParameter` | `withDefault` |
209-
| `ArrayParameter` | `withRequired`, `withOptional`, `withModify`, `withMakeOptional`, `withMakeRequired`, `without`, `withOptionalMinimum` |
210-
| `ObjectParameter` | `withClassName` |
211-
| `IterableParameter` | `withKey`, `withValue` |
206+
| Parameter | Immutable methods |
207+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------- |
208+
| `IntParameter` | `withMin`, `withMax`, `withAccept`, `withReject` |
209+
| `FloatParameter` | `withMin`, `withMax`, `withAccept`, `withReject` |
210+
| `StringParameter` | `withRegex` |
211+
| `ArrayParameter` | `withRequired`, `withOptional`, `withModify`, `withMakeOptional`, `withMakeRequired`, `without`, `withOptionalMinimum` |
212+
| `ObjectParameter` | `withClassName`, |
212213

213214
### Schema introspection
214215

0 commit comments

Comments
 (0)