PHP code example of novara / dynamic-readonly-classes
1. Go to this page and download the library: Download novara/dynamic-readonly-classes 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/ */
novara / dynamic-readonly-classes example snippets
DRCFactory::create(null, [
'Foo' => 'Bar',
])::Foo // returns 'Bar'
// SomeClass.php
abstract class SomeClass
{
public function test(): string
{
return static::TEST;
}
}
// Other code
DRCFactory::create(SomeClass::class, [
'TEST' => 'funny text here',
])->test(),