1. Go to this page and download the library: Download dgame/php-cast 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/ */
dgame / php-cast example snippets
$id = $data['id'] ?? null;
Assert::integer($id);
use function Dgame\Cast\Assume\int;
$id = int($data['id'] ?? null);
use function Dgame\Cast\Assert\int;
$id = int($data['id'] ?? null);
use function Dgame\Cast\Assert\int;
$id = int($data['id'] ?? null, message: 'The id of the given user must be of type int');
use function Dgame\Cast\Assume\intify;
$id = intify($data['id'] ?? null); // $id is of type int|null
use function Dgame\Cast\Assume\unsigned;
$id = unsigned($data['id'] ?? null); // $id is of type int|null and >= 0 if it is an int
use function Dgame\Cast\Assume\positive;
$id = positive($data['id'] ?? null); // $id is of type int|null and > 0 if it is an int
use function Dgame\Cast\Assume\negative;
$id = negative($data['id'] ?? null); // $id is of type int|null and < 0 if it is an int
use function Dgame\Cast\Assume\float;
$money = float($data['money'] ?? null); // $money is of type float|null
use function Dgame\Cast\Assume\bool;
$checked = bool($data['checked'] ?? null); // $checked is of type bool|null
use function Dgame\Cast\Assume\boolify;
$checked = boolify($data['checked'] ?? null); // $checked is of type bool|null
use function Dgame\Cast\Assume\stringify;
$value = stringify($data['value'] ?? null); // $value is of type string|null
use function Dgame\Cast\Assume\number;
$range = number($data['range'] ?? null); // $range is of type int|float|null
use function Dgame\Cast\Assume\scalar;
$value = scalar($data['value'] ?? null); // $value is of type int|float|bool|string|null
use function Dgame\Cast\Assume\collection;
$values = collection($data['values'] ?? null); // $values is of type array<int|string, mixed>|null
use function Dgame\Cast\Assume\collectionOf;
$values = collectionOf('Dgame\Cast\Assume\int', $data['values'] ?? null); // $values is of type array<int|string, int>|null
use function Dgame\Cast\Collection\filter;
$values = filter('Dgame\Cast\Assume\int', $data['values'] ?? []); // $values is of type array<int|string, int>
use function Dgame\Cast\Assume\listOf;
$values = listOf('Dgame\Cast\Assume\int', $data['values'] ?? null); // $values is of type int[]|null or, to be more accurate, of type array<int, int>|null
use function Dgame\Cast\Assume\mapOf;
$values = mapOf('Dgame\Cast\Assume\int', $data['values'] ?? null); // $values is of type array<string, int>|null
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.