PHP code example of astrotomic / php-conditional-proxy
1. Go to this page and download the library: Download astrotomic/php-conditional-proxy 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/ */
astrotomic / php-conditional-proxy example snippets
use Astrotomic\ConditionalProxy\HasConditionalCalls;
class MyClass
{
use HasConditionalCalls;
}
// foo() bar() baz() will be called
$class->foo()->when(true)->bar()->baz();
// foo() baz() will be called
$class->foo()->when(false)->bar()->baz();
// foo() bar() baz() will be called
$class->foo()->when(true, fn($self) => $self->bar())->baz();
// foo() baz() will be called
$class->foo()->when(false, fn($self) => $self->bar())->baz();
use Astrotomic\ConditionalProxy\ConditionalProxy;
class MyClass
{
public function if($condition)
{
return new ConditionalProxy($this, $condition);
}
public function foo($foo)
{
$this->foo = $foo;
return $this;
}
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.