Using Jackrabbit

If you maintain a bigger website, it might make sense to use Jackrabbit instead of the doctrine-dbal implementation of Jackalope. Jackrabbit performs better in many cases, and as a bonus it also supports Versioning of content.


Use the following command to install the jackrabbit adapter:

composer require jackalope/jackalope-jackrabbit

In addition to the previous command you also have to make sure that Jackrabbit is running on your server.


Change the config/packages/sulu_document_manager.yaml file to something similar as below. Mind that it is recommended to pass the URL via an environment variable, which can e.g. be set in your .env file.

    env(JACKRABBIT_URL): 'http://localhost:8080/server/'
    env(PHPCR_USER): 'admin'
    env(PHPCR_PASSWORD): 'admin'

                type: jackrabbit
                url: "%env(JACKRABBIT_URL)%"
            workspace: "%env(PHPCR_WORKSPACE)%"
            username: "%env(PHPCR_USER)%"
            password: "%env(PHPCR_PASSWORD)%"
                type: jackrabbit
                url: "%env(JACKRABBIT_URL)%"
            workspace: "%env(PHPCR_WORKSPACE)%_live"
            username: "%env(PHPCR_USER)%"
            password: "%env(PHPCR_PASSWORD)%"


The PHPCR_WORKSPACE is something similar as a database name so it is best practice to have a similar value for it, for example: su_myproject in your .env files.


In order to migrate from doctrinedbal to jackrabbit you have to export your data before changing the configuration:

bin/adminconsole doctrine:phpcr:workspace:export -p /cmf cmf.xml
bin/websiteconsole doctrine:phpcr:workspace:export -p /cmf cmf_live.xml
bin/adminconsole doctrine:phpcr:workspace:export -p /jcr:versions jcr.xml

Then change the configuration as explained in the above Configuration section, and then execute the following command to initialize the jackrabbit workspaces for sulu:

bin/adminconsole cache:clear
bin/adminconsole sulu:document:initialize

Now executed these commands to clear any previously existing data (first you should make sure that you really don’t need this data anymore).

bin/adminconsole doctrine:phpcr:node:remove /cmf
bin/websiteconsole doctrine:phpcr:node:remove /cmf
# the following command can fail if the node not exist ignore the error then:
bin/adminconsole doctrine:phpcr:node:remove /jcr:versions

After that you can import the exported data from doctrinedbal into jackrabbit by running the following commands:

bin/adminconsole doctrine:phpcr:workspace:import -p / cmf.xml
bin/websiteconsole doctrine:phpcr:workspace:import -p / cmf_live.xml
bin/adminconsole doctrine:phpcr:workspace:import -p / jcr.xml