Skip to content

Commit cd3453b

Browse files
committed
Update
1 parent 0b7418e commit cd3453b

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed

Diff for: book/getting_started.rst

+41-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
Getting Stated
22
==============
33

4-
This is an introduction into the PHP content repository. You will mostly see code examples. It should work with any PHPCR implementation. We propose using [Jackalope Jackrabbit](https://github.com/jackalope/jackalope-jackrabbit) to get started as it supports all features described here.
4+
This aims to provide a rounded general reference to PHPCR. You will mostly see
5+
code examples. It should work with any PHPCR implementation. We propose using
6+
[Jackalope Jackrabbit](https://github.com/jackalope/jackalope-jackrabbit) to
7+
get started as it supports all features described here.
58

69
Installing Jackalope
710
--------------------
811

9-
Just follow the README of the [jackalope-jackrabbit](https://github.com/jackalope/jackalope-jackrabbit/blob/master/README.md) repository.
12+
Just follow the README of the
13+
`jackalope-jackrabbit <https://github.com/jackalope/jackalope-jackrabbit/blob/master/README.md>`_
14+
repository.
1015

1116
Browser to see what is in the repository
1217
----------------------------------------
1318

14-
There are currently two options for browsing and modifying the contents of the PHPCR repository.
19+
There are currently two options for browsing and modifying the contents of the
20+
PHPCR repository.
1521

16-
- <a href="/documentation/phpcr-shell">PHPCR Shell</a>: Aims to provide a full command line shell interface to PHPCR content repositories. A pre-compiled PHAR archive is available on the github homepage.
17-
- <a href="https://github.com/marmelab/phpcr-browser">Marmelab PHPCR Browser</a>: A web based PHPCR browser.
22+
- `PHPCR Shell <https://github.com/phpcr/phpcr-shell>`_: Aims to provide a full
23+
command line shell interface to PHPCR content repositories. A pre-compiled
24+
PHAR archive is available on the github homepage.
25+
26+
- `Marmelab PHPCR Browser <https://github.com/marmelab/phpcr-browser>`_:
27+
A user-friendly web based PHPCR browser.
28+
29+
The shell is currently more feature complete, but the PHPCR Browser is more
30+
user friendly. We suggest you try both.
1831

1932
In a nutshell
2033
-------------
@@ -24,31 +37,46 @@ The shortest self-contained example should output a line with 'value':
2437
.. code-block:: php
2538
2639
<?php
27-
require("/path/to/jackalope-jackrabbit/vendor/autoload.php");
40+
require('/path/to/jackalope-jackrabbit/vendor/autoload.php');
2841
2942
$factoryclass = '\Jackalope\RepositoryFactoryJackrabbit';
3043
$parameters = array('jackalope.jackrabbit_uri' => 'http://localhost:8080/server');
44+
3145
// end of implementation specific configuration
3246
47+
// get a new PHPCR repository instance from the factory class defined above
3348
$factory = new $factoryclass();
3449
$repository = $factory->getRepository($parameters);
50+
51+
// create the credentials object to authenticate with the repository
3552
$credentials = new \PHPCR\SimpleCredentials('admin','admin');
53+
54+
// login to the repository and retrieve the session
3655
$session = $repository->login($credentials, 'default');
56+
57+
// retrieve the root node of the repository ("/")
3758
$root = $session->getRootNode();
59+
60+
// add a new node
3861
$node = $root->addNode('test', 'nt:unstructured');
62+
63+
// set a property on the newly created property
3964
$node->setProperty('prop', 'value');
65+
66+
// save the session, i.e. persist the data
4067
$session->save();
4168
42-
// data is stored now. in a follow-up request you can do
69+
// retrieve the newly created node
4370
$node = $session->getNode('/test');
4471
echo $node->getPropertyValue('prop'); // outputs "value"
4572
73+
4674
Still with us? Good, lets get in a bit deeper...
4775

4876
Get some data into the repository
4977
---------------------------------
5078

51-
We will discuss the import feature in more detail later, but to have some data, we just import something here. Create an XML file test.xml like this:
79+
We will discuss the import feature in more detail later, but to have some data, we just import something here. Create an XML file called `test.xml`:
5280

5381
.. code-block:: xml
5482
@@ -72,3 +100,8 @@ Now import this into the repository:
72100
$session->importXML('/', 'test.xml', \PHPCR\ImportUUIDBehaviorInterface::IMPORT_UUID_CREATE_NEW);
73101
$session->save();
74102
103+
You may also use the PHPCR Shell to import data:
104+
105+
.. code-block:: bash
106+
107+
$ phpcrsh -pmyprofile -c "session:import-xml test.xml"

0 commit comments

Comments
 (0)