Implementation of a PHP client for the Jackrabbit server, an implementation of the Java Content Repository JCR.
Implements the PHPCR interface (see http://phpcr.github.com for more about PHPCR).
Discuss on firstname.lastname@example.org or visit #jackalope on irc.freenode.net
License: This code is licenced under the apache license. Please see the file LICENSE in this folder.
- libxml version >= 2.7.0 (due to a bug in libxml http://bugs.php.net/bug.php?id=36501)
- phpunit >= 3.5 (if you want to run the tests)
The entry point is to create the repository factory. The factory specifies the storage backend as well.
$factoryclass = 'Jackalope\RepositoryFactoryJackrabbit'; $factory = new $factoryclass; $repository = $factory->getRepository(array('jackalope.jackrabbit_uri' => 'http://localhost:8080/server')); $credentials = new SimpleCredentials('username', 'password'); $session = $repository->login($credentials, 'default'); $rootNode = $session->getNode("/"); $whitewashing = $rootNode->addNode("www-whitewashing-de"); $session->save(); $posts = $whitewashing->addNode("posts"); $session->save(); $post = $posts->addNode("welcome-to-blog"); $post->addMixin("mix:title"); $post->setProperty("jcr:title", "Welcome to my Blog!"); $post->setProperty("jcr:description", "This is the first post on my blog! Do you like it?"); $session->save();
See https://github.com/phpcr/phpcr/blob/master/doc/Tutorial.md for how to use the PHPCR API
Our continuos integration server with coverage reports at: http://bamboo.liip.ch/browse/JACK
Running the api tests
Run phpunit with the configuration in api-tests phpunit -c /path/to/jackalope/api-tests
You should see mostly success, but there might be the odd error or failure
There are two kind of tests. The folder api-tests contains the phpcr-api-tests suite to test against the specification. This is what you want to look at when using jackalope as a PHPCR implementation.
The folder tests contains unit tests for the jackalope implementation. You should only need those if you want to debug jackalope itselves or implement new features. Again, make sure you have the test workspace in jackrabbit.
The phpunit.xml in api-tests runs all tests, both the unit and the api tests. The phpunit.xml in tests runs only the unit tests.