Darken\Attributes\PostParam

class

An attribute that marks a property to be populated from POST data (e.g., form submissions). If a custom $name is provided, that POST field name will be used. Otherwise, the property’s name is used by default.

Example usage:

#[PostParam('username')]
public string $user;

// In a POST request with `username=JohnDoe`, the $user property
// will be populated with "JohnDoe".

#[PostParam]
public string $password;

// In a POST request with `password=mySecret`, the $password
// property will be populated with "mySecret".

Methods

Method Details

public __construct (?string $name) PostParam.php#37
$name ?string