This is the API documentation of the PHP Content Repository API based on the Java Content Repository specification (JSR-283). If you know JCR, get the differences between PHPCR and JCR at a glance. To learn PHPCR, please have a look at our tutorial.
For general information on PHPCR see phpcr.github.com
use PHPCR\SimpleCredentials; $factoryclass = 'Jackalope\RepositoryFactoryJackrabbit'; $parameters = array( 'jackalope.jackrabbit_uri' => 'http://localhost:8080/server', ); // end of implementation specific configuration $factory = new $factoryclass(); $repository = $factory->getRepository($parameters); $credentials = new SimpleCredentials('admin','admin'); $session = $repository->login($credentials, 'default'); $root = $session->getRootNode(); $node = $root->addNode('test', 'nt:unstructured'); $node->setProperty('prop', 'value'); $session->save(); ... $node = $session->getNode('/test'); echo $node->getPropertyValue('prop');
Note that the classes in the namespace PHPCR\Util are not part of the PHPCR standard but provided to cover
common use cases of PHPCR implementations and client applications. The utils are implementation neutral.
Jackalope and Doctrine PHPCR-ODM use them, but
other implementations might not. You can simply require phpcr/phpcr-utils in your projects composer.json file to be sure to have them.
PHPCR and this documentation are available under the Apache Software License 2.0.