PHP code example of fratily / clone-with
1. Go to this page and download the library: Download fratily/clone-with 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/ */
fratily / clone-with example snippets
class Foo {
public function __construct(
public readonly string $value_string,
public readonly int $value_int,
) {}
public function withString(string $new_value)
{
return clone_with_new_props($this, ['value_string' => $new_value]);
}
public function withInt(int $new_value)
{
return clone_with_new_props($this, ['value_int' => $new_value]);
}
}