2017 © Pedro PelĂĄez
 

library jackalope-jackrabbit

Jackalope Transport library for Jackrabbit

image

jackalope/jackalope-jackrabbit

Jackalope Transport library for Jackrabbit

  • Wednesday, November 22, 2017
  • by cordoval
  • Repository
  • 12 Watchers
  • 56 Stars
  • 320,522 Installations
  • PHP
  • 36 Dependents
  • 8 Suggesters
  • 29 Forks
  • 14 Open issues
  • 31 Versions
  • 5 % Grown

The README.md

Jackalope Jackrabbit

Build Status Latest Stable Version Total Downloads, (*1)

Jackalope is a powerful implementation of the PHP Content Repository API (PHPCR)., (*2)

Jackalope-Jackrabbit is using the jackrabbit JCR server as storage engine., (*3)

Discuss on jackalope-dev@googlegroups.com or visit #jackalope on irc.freenode.net, (*4)

License

This code is dual licensed under the MIT license and the Apache License Version 2.0. Please see the file LICENSE in this folder., (*5)

Preconditions

Installation

The recommended way to install jackalope is through composer., (*6)

$ mkdir my-project
$ cd my-project
$ composer init
$ composer require jackalope/jackalope-jackrabbit

Jackrabbit storage server

Besides the Jackalope repository, you need the Jackrabbit server component. For instructions, see Jackalope Wiki Make sure you have at least the version specified in the VERSION constant of the protocol implementation, (*7)

phpunit tests

If you want to run the tests, please see the README file in the tests folder and check if you told composer to install the suggested dependencies (see Installation), (*8)

Enable the commands

There are a couple of useful commands to interact with the repository., (*9)

To use the console, copy cli-config.php.dist to cli-config.php and configure the connection parameters. Then you can run the commands from the jackalope directory with ./bin/jackalope, (*10)

NOTE: If you are using PHPCR inside of Symfony, the DoctrinePHPCRBundle provides the commands inside the normal Symfony console and you don't need to prepare anything special., (*11)

There is the Jackalope specific command jackalope:run:jackrabbit which you can use to start and stop a jackrabbit standalone server., (*12)

You have many useful commands available from the phpcr-utils. To get a list of all commands, type:, (*13)

./bin/jackalope

To get more information on a specific command, use the help command. To learn more about the phpcr:workspace:export command for example, you would type:, (*14)

./bin/jackalope help phpcr:workspace:export

Bootstrapping

Jackalope relies on autoloading. Namespaces and folders are compliant with PSR-0. You should use the autoload file generated by composer: vendor/autoload.php, (*15)

If you want to integrate jackalope into other PSR-0 compliant code and use your own classloader, find the mapping in vendor/composer/autoload_namespaces.php, (*16)

Once you have autoloading, you need to bootstrap the library. A minimalist sample code to get a PHPCR session with the jackrabbit backend:, (*17)

$jackrabbit_url = 'http://127.0.0.1:8080/server/';
$user           = 'admin';
$pass           = 'admin';
$workspace      = 'default';

$factory = new \Jackalope\RepositoryFactoryJackrabbit();
$repository = $factory->getRepository(
    array("jackalope.jackrabbit_uri" => $jackrabbit_url)
);
$credentials = new \PHPCR\SimpleCredentials($user, $pass);
$session = $repository->login($credentials, $workspace);

To use a workspace different than default you need to create it first. The easiest is to run the command bin/jackalope phpcr:workspace:create <myworkspace> but you can of course also use the PHPCR API to create workspaces from your code., (*18)

Usage

The entry point is to create the repository factory. The factory specifies the storage backend as well. From this point on, there are no differences in the usage (except for supported features, that is)., (*19)

// see Bootstrapping for how to get the session.

$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 PHPCR Tutorial for a more detailed tutorial on how to use the PHPCR API., (*20)

Query Languages

Jackalope supports the PHPCR standard query language SQL2 as well as the Query Object Model (QOM) to build queries programmatically. We recommend using the QOM or the QueryBuilder mentioned in the PHPCR Tutorial. They are built to use the best possible query language depending on the capabilities of the backend. A later switching to another PHPCR implementation shouldn't cause any issues then., (*21)

Jackalope-Jackrabbit also supports the deprecated SQL and XPath query languages from JCR 1.0. Those languages will be supported by Jackrabbit for the foreseeable future, but almost certainly won't be supported by other PHPCR implementations. So use them with care and only if you know what you are doing., (*22)

One reason for using SQL or XPath is that the newer and more capable SQL2 is not as optimized as the older languages on the Jackrabbit side. Queries with large result sets are much slower with SQL2 than with XPath or SQL., (*23)

However, the best is to use the QueryBuilder mentioned above to let the implementation chose the most efficient query language for your implementation., (*24)

Performance tweaks

If you know that you will need many child nodes of a node you are about to request, use the depth hint on Session::getNode. This will prefetch the children to reduce the round trips to the database. It is part of the PHPCR standard. You can also globally set a fetch depth, but that is Jackalope specific: Call Session::setSessionOption with Session::OPTION_FETCH_DEPTH to something bigger than 1., (*25)

Use Node::getNodeNames if you only need to know the names of child nodes, but don't need the actual nodes. Note that you should not use the typeFilter on getNodeNames with jackalope. Using the typeFilter with getNodes to only fetch the nodes of types that interest you can make a lot of sense however., (*26)

Logging

Jackalope supports logging, for example to investigate the number and type of queries used. To enable logging, provide a logger instance to the repository factory:, (*27)

$factory = new \Jackalope\RepositoryFactoryJackrabbit();
$logger = new Jackalope\Transport\Logging\DebugStack();
$options = array(
    'jackalope.jackrabbit_uri' => $jackrabbit_url,
    'jackalope.logger' => $logger,
);
$repository = $factory->getRepository($options);

...

// at the end, output debug information
var_dump($logger->calls);

You can also wrap a PSR-3 compatible logger like monolog with the Psr3Logger class., (*28)

Note that when using jackalope in Symfony2, the logger is integrated in the debug toolbar., (*29)

Implementation notes

See doc/architecture.md for an introduction how Jackalope is built. Have a look at the source files and generate the phpdoc., (*30)

Not implemented features

The best overview of what needs to be done are the skipped API tests. Have a look at ImplementationLoader to see what is currently not working and start hacking :-), (*31)

Contributors

The Versions

22/11 2017

dev-master

9999999-dev http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

22/11 2017

dev-fix-test-warning

dev-fix-test-warning http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

22/11 2017

1.3.2

1.3.2.0 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

27/04 2017

1.3.1

1.3.1.0 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

07/04 2017

1.3.0

1.3.0.0 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

18/10 2015

1.2.2

1.2.2.0 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

15/08 2015

1.2.1

1.2.1.0 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

17/06 2015

dev-poc_phpbench

dev-poc_phpbench http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

02/05 2015

1.2.0

1.2.0.0 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

01/05 2015

dev-acl

dev-acl http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

05/04 2015

1.2.0-RC1

1.2.0.0-RC1 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

13/11 2014

1.1.x-dev

1.1.9999999.9999999-dev http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

13/11 2014

1.1.3

1.1.3.0 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

01/07 2014

dev-oak

dev-oak http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

25/05 2014

1.1.2

1.1.2.0 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

28/02 2014

1.1.1

1.1.1.0 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

02/02 2014

1.1.0

1.1.0.0 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

08/01 2014

1.1.0-RC1

1.1.0.0-RC1 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

14/12 2013

1.0.x-dev

1.0.9999999.9999999-dev http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

01/11 2013

1.0.1

1.0.1.0 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

10/10 2013

1.0.0

1.0.0.0 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

05/10 2013

1.0.0-RC3

1.0.0.0-RC3 http://jackalope.github.com

Jackalope Transport library for Jackrabbit

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

phpcr transport implementation jackrabbit

02/10 2013

1.0.0-RC2

1.0.0.0-RC2 http://jackalope.github.com

Jackalope Transport library

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

transport implementation jackrabbit

25/09 2013

1.0.0-RC1

1.0.0.0-RC1 http://jackalope.github.com

Jackalope Transport library

  Sources   Download

MIT Apache-2.0

The Requires

 

The Development Requires

transport implementation jackrabbit

31/07 2013

1.0.0-beta4

1.0.0.0-beta4 http://jackalope.github.com

Jackalope Transport library

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

transport implementation jackrabbit

11/07 2013

1.0.0-beta3

1.0.0.0-beta3 http://jackalope.github.com

Jackalope Transport library

  Sources   Download

MIT

The Requires

 

The Development Requires

transport implementation jackrabbit

09/06 2013

1.0.0-beta2

1.0.0.0-beta2 http://jackalope.github.com

Jackalope Transport library

  Sources   Download

MIT

The Requires

 

The Development Requires

transport implementation jackrabbit

04/05 2013

1.0.0-beta1

1.0.0.0-beta1 http://jackalope.github.com

Jackalope Transport library

  Sources   Download

MIT

The Requires

 

The Development Requires

transport implementation jackrabbit

02/05 2013

dev-oak-crx

dev-oak-crx http://jackalope.github.com

Jackalope Transport library

  Sources   Download

MIT

The Requires

 

The Development Requires

transport implementation jackrabbit

26/03 2013

1.0.0-alpha3

1.0.0.0-alpha3 http://jackalope.github.com

Jackalope Transport library

  Sources   Download

MIT

The Requires

 

The Development Requires

transport implementation jackrabbit

10/03 2013

1.0.0-alpha2

1.0.0.0-alpha2 http://jackalope.github.com

Jackalope Transport library

  Sources   Download

MIT

The Requires

 

The Development Requires

transport implementation jackrabbit