Skip to content

Commit 9d9bb99

Browse files
committed
Created PHPCR-Shell documentation
1 parent 9fd147b commit 9d9bb99

File tree

4 files changed

+211
-3
lines changed

4 files changed

+211
-3
lines changed

index.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ Welcome to PHPCR's documentation!
99
Contents:
1010

1111
.. toctree::
12-
:maxdepth: 2
12+
:maxdepth: 1
1313

1414
book/index
15-
16-
15+
phpcr-shell/index
1716

1817
Indices and tables
1918
==================

phpcr-shell/connecting.rst

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
Connecting
2+
==========
3+
4+
Manually
5+
--------
6+
7+
.. note::
8+
9+
The following sections detail how to create a connection, you should
10+
however only do this once and create a profile. With a profile you
11+
can reuse connection settings, see :ref:`phpcrsh_profile`.
12+
13+
Jackrabbit
14+
~~~~~~~~~~
15+
16+
The following should work with the default
17+
18+
.. code-block:: bash
19+
20+
$ phpcrsh --transport=jackrabbit
21+
22+
Parameters:
23+
24+
- **repo-url**: URL for server, default ``http://localhost:8080/server``
25+
26+
Doctrine-Dbal
27+
~~~~~~~~~~~~~
28+
29+
General connections
30+
"""""""""""""""""""
31+
32+
The following is the minimal required to connect to a MySQL database:
33+
34+
.. code-block:: bash
35+
36+
$ phpcrsh --transport=doctrine-dbal --db-name="mydb"
37+
38+
Parameters:
39+
40+
- **db-name**: Name of database to connect to
41+
- **db-user**: Username for database, default ``root``
42+
- **db-password**: Password for datanase, default empty
43+
- **db-host**: Host for database, default ``localhost``
44+
- **db-path**: Path to sqlite database
45+
46+
Connect to Sqlite database
47+
""""""""""""""""""""""""""
48+
49+
.. code-block:: bash
50+
51+
$ phpcrsh --transport=doctrine-dbal --db-path=/path/to/app.sqlite
52+
53+
More settings
54+
~~~~~~~~~~~~~
55+
56+
For a full list of settings run:
57+
58+
.. code-block:: bash
59+
60+
$ phpcrsh --help
61+
62+
.. _phpcrsh_profile:
63+
64+
Profiles
65+
--------
66+
67+
You can create or use a profile using a single option, `--profile` or `-p` for short.
68+
69+
For example:
70+
71+
.. code-block:: bash
72+
73+
$ phpcrsh -pmyapp --transport=doctrine-dbal --db-path=/path/to/app.sqlite
74+
75+
Will *create* a profile called ``myapp``. Profiles are stored as YAML files in
76+
``$HOME:./.phpcrsh/profiles/<profilename>``. And can be manually edited.
77+
78+
To select a profile launch PHPCRSH without any arguments
79+
80+
.. code-block:: bash
81+
82+
$ phpcrsh
83+
No connection parameters, given. Select an existing profile:
84+
85+
(0) dtlweb
86+
(1) ezcmf
87+
(2) jackrabbit
88+
(3) ratest
89+
(4) slinp_test
90+
(5) slinptest
91+
(6) sulucmf
92+
93+
Enter profile number: []
94+
95+
To explicitly use a profile use the `-p` option again:
96+
97+
.. code-block:: bash
98+
99+
$ phpcrsh --profile ratest
100+
# or
101+
$ phpcrsh -pratest
102+
103+
.. note::
104+
105+
A profile is only created if the ``transport`` option is set.
106+
107+
Connect to an embedded PHPCR shell
108+
----------------------------------
109+
110+
This is the easiest way to connect if you have are developing a Symfony 2 application
111+
112+
See :ref:`phpcrsh-installation-embedded-application`.
113+
114+
You can then connect simply using:
115+
116+
.. code-block:: bash
117+
118+
$ php app/console phpcr:shell
119+
120+
And you can execute specific commands:
121+
122+
.. code-block:: bash
123+
124+
$ php app/console phpcr:shell node:list /cms
125+
126+
Queries or commands with options must be escapted due to limitations with the Symfony
127+
console component:
128+
129+
.. code-block:: bash
130+
131+
$ php app/console phpcr:shell "SELECT * FROM [nt:unstructured]"
132+
$ php app/console phpcr:shell "node:list -L2"

phpcr-shell/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
PHPCR-Shell
2+
===========
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
installation
8+
connecting

phpcr-shell/installation.rst

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
Installation
2+
============
3+
4+
You can install PHPCR Shell either as an embedded application or as a PHAR, or
5+
you can built it your self (for instance if you want the latest version).
6+
7+
.. _phpcrsh-connecting-installation-as-phar:
8+
9+
Install as a PHAR
10+
-----------------
11+
12+
The latest release can be downloaded from the `Github releases page
13+
<https://github.com/doctrine/DoctrinePHPCRBundle/>`_.
14+
15+
After downloading it it is recommended to install it in a path accessible
16+
by the system, for example:
17+
18+
.. code-block:: bash
19+
20+
$ sudo mv phpcrsh.sh /usr/local/bin/phpcrsh
21+
$ sudo chmod a+x /usr/local/bin/phpcrsh
22+
23+
You can now run PHPCRSH from anywhere:
24+
25+
.. code-block:: bash
26+
27+
$ phpcrsh --help
28+
29+
.. _phpcrsh-installation-embedded-application:
30+
31+
Install as an embedded application
32+
----------------------------------
33+
34+
If you are using a Symfony2 application and the `DoctrinePHPCRBundle <https://github.com/doctrine/DoctrinePHPCRBundle/>`_
35+
then you can easily integrate the PHPCR-Shell.
36+
37+
Simply add the shell to your ``composer.json`` file
38+
39+
.. code-block:: javascript
40+
41+
{
42+
...
43+
require: {
44+
...
45+
"phpcr-shell": "<lastest version here>"
46+
}
47+
...
48+
}
49+
50+
And you can connect directly:
51+
52+
.. code-block:: bash
53+
54+
$ php app/console phpcr:shell
55+
56+
Build it from source
57+
--------------------
58+
59+
PHPSH uses the box PHAR building tool, install it `here <http://box-project.org>`_.
60+
61+
Build the PHAR:
62+
63+
.. code-block:: bash
64+
65+
$ cd phpcr-shell
66+
$ box build
67+
68+
This will produce the file ``phpcr.phar``, see :ref:`phpcrsh-connecting-installation-as-phar` for
69+
further instructions.

0 commit comments

Comments
 (0)