Created: 2011-07-10 19:09
Updated: 2014-01-18 03:28


A simple library that provides functionality to access php objects using path strings.


I've written parts of this library repeatedly throughout different projects, and you'll see simmilar classes and functions thouroughout almost every php framework. Rather than rewriting the wheel over and over, I thought to make a small library that will fit 90% of the need for string based object access.

Primarily this libarary is useful when resolving configuration strings against php objects and arrays.

Improvements Welcome

I'll be the first to admit that this library is far from complete, so please fork and commit your improvements.

Examples of use

use WebDev\Conventional\Resolver;

$array['my']['foo'] = "a-foo";
$array['my']['bar'] = "a-bar";

$resolver = new Resolver();
echo $resolver($array,"my[foo]"); // a-foo
echo $resolver($array,""); // a-bar

$object->my->foo = "o-foo";

$resolver = new Resolver();
echo $resolver->get($object,""); // o-foo
echo $resolver->get($object,"bar"); // o-bar via $object->getBar()

use WebDev\Conventional\StringTransformer;

$transform = new StringTransformer("my/{}/{bar}/{baz}",$object);
echo $transform(); // my/o-foo/o-bar/{baz}
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more