1. Go to this page and download the library: Download kint/vo 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/ */
$secretAgent = new VO\SecretAgent(['name' => 'Bond', 'email' => '[email protected]']);
// Now you can use magic methods and get values from your VO.
$secretAgentName = $secretAgent->getName();
$secretAgentEmail = $secretAgent->getEmail();
// Also you can pass this VO as parameter.
$controller->doSomethingWithSecretAgent($secretAgent);
use VO\SecretAgent;
use ValueObject\Exception\ValidationException;
try {
$secretAgent = new SecretAgent(['name' => 'Bond', 'email' => 'error']);
} catch (ValidationException $e) {
$errors = $e->getMessages();
}
class SecretAgentController
{
public function indexAction(array $postData)
{
(new SecretAgentService())->doSomethingWithSecretAgent(new VO\SecretAgent($postData));
}
}
class SecretAgentService
{
public function doSomethingWithSecretAgent(VO\SecretAgent $secretAgent)
{
(new SecretAgentModel())->update($secretAgent);
}
}
class SecretAgentModel
{
public function update(VO\SecretAgent $secretAgent)
{
$secretAgentName = $secretAgent->getName();
$secretAgentEmail = $secretAgent->getEmail();
// Update model.
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.