Skip to content

Commit b0c96a6

Browse files
committed
Merge pull request #12 from phpcr/phpcr-shell-doc
Created PHPCR-Shell documentation
2 parents c4944f4 + dd83c6b commit b0c96a6

File tree

7 files changed

+4666
-3
lines changed

7 files changed

+4666
-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/configuration.rst

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
Configuration
2+
=============
3+
4+
Initialization and reloading
5+
----------------------------
6+
7+
The configuration files can be initialized and reloaded at any time using the
8+
:ref:`phpcr_shell_command_shellconfiginit` and :ref:`phpcr_shell_command_shellconfigreload`
9+
commands:
10+
11+
.. code-block:: bash
12+
13+
PHPCRSH> shell:config:init
14+
PHPCRSH> shell:config:reload
15+
16+
At time of writing the only configuration file affected by these commands is
17+
the ``aliases.yml`` file detailed below.
18+
19+
.. _phpcrsh_configuration_aliases:
20+
21+
Aliases
22+
-------
23+
24+
PHPCRSH supports aliases. Aliases are shortcuts for commands.
25+
26+
Aliases are stored in the file ``$HOME/.phpcrsh/aliases.yml``, which is created
27+
automatically when launching the PHPCR Shell.
28+
29+
You can list the current aliases with the :ref:`phpcr_shell_command_shellaliaslist` command.
30+
31+
For example:
32+
33+
.. code-block:: bash
34+
35+
PHPCRSH> ls
36+
PHPCRSH> pwd
37+
PHPCRSH> refresh
38+
PHPCRSH> save
39+
40+
Are all examples of aliases.
41+
42+
Below is the distribution version of this file at time of writing:
43+
44+
.. code-block:: yaml
45+
46+
# Shell shortcuts
47+
aliases: shell:alias:list
48+
creload: shell:config:reload
49+
cinit: shell:config:init
50+
51+
# MySQL commands
52+
use: workspace:use {arg1}
53+
explain: node-type:show {arg1}
54+
55+
# Filesystem commands
56+
cd: shell:path:change {arg1}
57+
rm: node:remove {arg1}
58+
mv: node:move {arg1} {arg2}
59+
pwd: shell:path:show
60+
exit: shell:exit
61+
62+
# Node commands
63+
ls: node:list {arg1}
64+
ln: node:clone {arg1} {arg2} # symlink, as in ln -s
65+
cp: node:copy {arg1} {arg2}
66+
cat: node:property:show {arg1}
67+
touch: node:property:set {arg1} {arg2} {arg3}
68+
mkdir: node:create {arg1} {arg2}
69+
70+
# Node type commands
71+
mixins: node-type:list "^mix:"
72+
nodetypes: node-type:list {arg1}
73+
ntedit: node-type:edit {arg1}
74+
ntshow: node-type:show {arg1}
75+
76+
# Workspace commands
77+
workspaces: workspace:list
78+
79+
# Namespsce commands
80+
namespaces: workspace:namespace:list {arg1}
81+
nsset: workspace:namespace:register
82+
83+
# Editor commands
84+
vi: node:edit {arg1} {arg2}
85+
vim: node:edit {arg1} {arg2}
86+
nano: node:edit {arg1} {arg2}
87+
88+
# GNU commands
89+
man: help {arg1}
90+
91+
# Version commands
92+
checkin: version:checkin {arg1}
93+
ci: version:checkin {arg1}
94+
co: version:checkout {arg1}
95+
checkout: version:checkout {arg1}
96+
cp: version:checkpoint {arg1}
97+
checkpoint: version:checkpoint {arg1}
98+
vhist: version:history {arg1}
99+
versions: version:history {arg1}
100+
101+
# Session commands
102+
save: session:save
103+
refresh: session:refresh
104+
105+
For a full reference enter in the shell:
106+
107+
.. code-block:: bash
108+
109+
PHPCRSH> shell:alias:list

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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
PHPCR-Shell
2+
===========
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
installation
8+
connecting
9+
interacting
10+
configuration
11+
reference

phpcr-shell/installation.rst

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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 a version of `DoctrinePHPCRBundle
35+
<https://github.com/doctrine/DoctrinePHPCRBundle/>`_ greater than 1.2 then you
36+
can easily integrate the PHPCR-Shell.
37+
38+
Simply add the shell to your ``composer.json`` file
39+
40+
.. code-block:: javascript
41+
42+
{
43+
...
44+
require: {
45+
...
46+
"phpcr-shell": "<lastest version here>"
47+
}
48+
...
49+
}
50+
51+
And you can connect directly:
52+
53+
.. code-block:: bash
54+
55+
$ php app/console phpcr:shell
56+
57+
Build it from source
58+
--------------------
59+
60+
PHPSH uses the box PHAR building tool, install it `here <http://box-project.org>`_.
61+
62+
Build the PHAR:
63+
64+
.. code-block:: bash
65+
66+
$ cd phpcr-shell
67+
$ box build
68+
69+
This will produce the file ``phpcr.phar``, see :ref:`phpcrsh-connecting-installation-as-phar` for
70+
further instructions.

0 commit comments

Comments
 (0)