1. Go to this page and download the library: Download php-forge/support 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/ */
php-forge / support example snippets
declare(strict_types=1);
namespace PHPForge\Support\Tests;
use PHPForge\Support\Assert;
Assert::equalsWithoutLE(
<<<Text
Foo
Bar
Text,
"Foo\nBar"
);
declare(strict_types=1);
namespace PHPForge\Support\Tests;
use PHPForge\Support\Assert;
$object = new class () {
private string $foo = 'bar';
};
$this->assertSame('bar', Assert::inaccessibleProperty($object, 'foo'));
declare(strict_types=1);
namespace PHPForge\Support\Tests;
use PHPForge\Support\Assert;
$object = new class () {
protected function foo(): string
{
return 'foo';
}
};
$this->assertSame('foo', Assert::invokeMethod($object, 'foo'));
declare(strict_types=1);
namespace PHPForge\Support\Tests;
use PHPForge\Support\Assert;
$object = new class () {
private string $foo = 'bar';
};
Assert::setInaccessibleProperty($object, 'foo', 'baz');
$this->assertSame('baz', Assert::inaccessibleProperty($object, 'foo'));