PHP code example of polyprism / runtime

1. Go to this page and download the library: Download polyprism/runtime library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

polyprism / runtime example snippets


Normalise::apply(string $value, array $ops): string
Normalise::applyNullable(?string $value, array $ops): ?string



declare(strict_types=1);

use Polyprism\Runtime\Coerce;
use Polyprism\Runtime\Normalise;

final class OrderQuoteRequest
{
    public int $totalCents;
    public string $email;
    public \DateTimeImmutable $requestedAt;

    public function __construct(int|string $totalCents, string $email, \DateTimeImmutable|string|int $requestedAt)
    {
        // Boundary normalisation happens once at construction — no
        // property hooks