1. Go to this page and download the library: Download socialengine/unum 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/ */
socialengine / unum example snippets
class MyEntity extends \SocialEngine\Unum\Entity
{
protected $name;
protected $email;
}
$entity = new MyEntity(['name' => 'Duke', 'email' => '[email protected]']);
$entity = new MyEntity(['name' => 'Duke', 'email' => '[email protected]']);
echo $entity->name; // Duke
echo $entity['email']; // [email protected]
class GetMethodEntity extends \SocialEngine\Unum\Entity
{
protected $name;
protected function getName()
{
return $name . ' From Method!';
}
}
$entity = new GetMethodEntity(['name' => 'Hello']);
var_dump($entity->name); // string(18) "Hello From Method!"
class SetMethodEntity extends \SocialEngine\Unum\Entity
{
protected $name;
protected function setName($value)
{
$this->name = $name . ' Set By Method!';
}
}
$entity = new SetMethodEntity(['name' => 'Hello']);
var_dump($entity->name); // string(20) "Hello Set By Method!"
$entity = new MyEntity();
$entity->name = 'My Name';
var_dump($entity->toArray(true));
/*
array(1) {
'name' =>
string(7) "My Name"
}
*/