Is there a php library for converting data structures?

Colleagues, prompt the library to convert data structures (arrays, objects).

For example, there is an array (or object with this structure)
$student['name']='Vasya Pupkin';

I need to:
$user['type']='student'; // a Constant, the same for all transformations of this type
$user['realname']='Vasya Pupkin';

I could write:
$user = array('type'=>'student','realname'=>$student['name'] ....);

But I don't want to.
I want to specify transformation rules in a separate object/configuration file to the conversion performed by the library. Among other things, this will help not hardcoding the data model rigidly, and ask it separately.
That is, we need some simple (and lightweight) analogue XSLT to transform data structures in PHP.
Came across something like that?
March 19th 20 at 08:23
2 answers
March 19th 20 at 08:25
Thank you for the interesting thing, though not quite what I was asking: in the examples on the website describes the conversion anyway in the form of executable php code. That is, if you put it in the database will have to execute through eval(). - wilson.Rob commented on March 19th 20 at 08:28
Put in dB DSL, on the basis of which to generate transformery - Gene17 commented on March 19th 20 at 08:31
@Gene17, actually, about it and speech. Which processor DSL in PHP advise for this problem? - wilson.Rob commented on March 19th 20 at 08:34
March 19th 20 at 08:27
$user = array('type'=>'student','realname'=>$student['name'] ....);

Write it in the form of adapter.
The question is not how to implement it, but to find an existing library, the entrance of which it would be possible to apply rules of the form:
$rules[]=array('cmd'=> ' copy,'source'=>'contacts/email','destinee'=>'email');
and don't paint your bike, if there is ready :) - wilson.Rob commented on March 19th 20 at 08:30
@wilson.Rob, in this case a couple of lines of his "bike" to write faster and easier than finding someone else. - Tevin_Rowe commented on March 19th 20 at 08:33
@Tevin_Rowe, well, there is not a couple of lines, it is necessary to work with nesting, to handle situations of lack of data in the source, add different rules for entering constants, conversions, recursive changes in the structure, etc. to Work and throw exception, write examples, documentation, cover with automatic tests. It turns out a special project that you need to write and maintain.
Of course, I wrote a simple library on the priorities, but I want a normal tool. - wilson.Rob commented on March 19th 20 at 08:36

Find more questions by tags PHP