1. Go to this page and download the library: Download dvasilenko/datamapper_tools 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/ */
dvasilenko / datamapper_tools example snippets
use DataMapper\Tools\BaseDataMapper;
class MyDataMapper extends BaseDataMapper
{
protected $rules = [
'ruleCode' => [],
];
}
/**
* Если необходимо проверить на XSD, привязка к ключу правила, значение путь к xsd файлу
* @var array
*/
protected $xsd = [
//'ruleCode' => '',
];
/**
* Корневой XML документ
* @var string
*/
protected $xml = '<?xml version="1.0" encoding="UTF-8"
use DataMapper\Tools\Contracts\ResolveInterface,
DataMapper\Tools\Resolve\Base;
class Fio extends Base implements ResolveInterface
{
public static function run(array $val, array $data)
{
$name = self::getValByKey($val['params']['name'], $data);
$lastName = self::getValByKey($val['params']['lastName'], $data);
return implode(' ', [$lastName, $name]);
}
}