1. Go to this page and download the library: Download cline/data 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/ */
cline / data example snippets
use Cline\Data\Attributes\Validation\{PresentIf, MissingIf};
use Spatie\LaravelData\Data;
class OrderData extends Data
{
public function __construct(
#[PresentIf('type', 'premium')]
public ?string $upgradeOption = null,
#[MissingIf('automatic_renewal', true)]
public ?int $renewalDays = null,
) {}
}
use Cline\Data\Casts\{TrimCast, UpperCaseCast, NumberLikeCast};
use Spatie\LaravelData\Data;
class UserData extends Data
{
public function __construct(
#[TrimCast, UpperCaseCast]
public string $name,
#[NumberLikeCast]
public int $accountId,
) {}
}
use Cline\Data\Types\{StringLike, BooleanLike, NumberLike};
// Coerce values to appropriate types
$stringValue = StringLike::coerce('hello');
$boolValue = BooleanLike::coerce('true');
$numberValue = NumberLike::coerce('42.5');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.