1. Go to this page and download the library: Download osmianski/super-objects 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/ */
osmianski / super-objects example snippets
use Osmianski\SuperObjects\SuperObject;
...
/**
* @property string $message
*/
class Foo extends SuperObject
{
protected function get_message(): string {
return 'Hello, world!';
}
}
$foo = new Foo();
// executing the getter
echo $foo->message;
// using the stored value
echo $foo->message;
$foo = new Foo(['message' => 'custom message']);
// prints the custom message
echo $foo->message;
use Osmianski\SuperObjects\Exceptions\Required;
...
/**
* @property string $message
*/
class Foo extends SuperObject
{
protected function get_message(): string {
throw new Required(__METHOD__);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.