-
Notifications
You must be signed in to change notification settings - Fork 5
Created PHPCR-Shell documentation #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
Connecting | ||
========== | ||
|
||
Manually | ||
-------- | ||
|
||
.. note:: | ||
|
||
The following sections detail how to create a connection, you should | ||
however only do this once and create a profile. With a profile you | ||
can reuse connection settings, see :ref:`phpcrsh_profile`. | ||
|
||
Jackrabbit | ||
~~~~~~~~~~ | ||
|
||
The following should work with the default | ||
|
||
.. code-block:: bash | ||
|
||
$ phpcrsh --transport=jackrabbit | ||
|
||
Parameters: | ||
|
||
- **repo-url**: URL for server, default ``http://localhost:8080/server`` | ||
|
||
Doctrine-Dbal | ||
~~~~~~~~~~~~~ | ||
|
||
General connections | ||
""""""""""""""""""" | ||
|
||
The following is the minimal required to connect to a MySQL database: | ||
|
||
.. code-block:: bash | ||
|
||
$ phpcrsh --transport=doctrine-dbal --db-name="mydb" | ||
|
||
Parameters: | ||
|
||
- **db-name**: Name of database to connect to | ||
- **db-user**: Username for database, default ``root`` | ||
- **db-password**: Password for datanase, default empty | ||
- **db-host**: Host for database, default ``localhost`` | ||
- **db-path**: Path to sqlite database | ||
|
||
Connect to Sqlite database | ||
"""""""""""""""""""""""""" | ||
|
||
.. code-block:: bash | ||
|
||
$ phpcrsh --transport=doctrine-dbal --db-path=/path/to/app.sqlite | ||
|
||
More settings | ||
~~~~~~~~~~~~~ | ||
|
||
For a full list of settings run: | ||
|
||
.. code-block:: bash | ||
|
||
$ phpcrsh --help | ||
|
||
.. _phpcrsh_profile: | ||
|
||
Profiles | ||
-------- | ||
|
||
You can create or use a profile using a single option, `--profile` or `-p` for short. | ||
|
||
For example: | ||
|
||
.. code-block:: bash | ||
|
||
$ phpcrsh -pmyapp --transport=doctrine-dbal --db-path=/path/to/app.sqlite | ||
|
||
Will *create* a profile called ``myapp``. Profiles are stored as YAML files in | ||
``$HOME:./.phpcrsh/profiles/<profilename>``. And can be manually edited. | ||
|
||
To select a profile launch PHPCRSH without any arguments | ||
|
||
.. code-block:: bash | ||
|
||
$ phpcrsh | ||
No connection parameters, given. Select an existing profile: | ||
|
||
(0) dtlweb | ||
(1) ezcmf | ||
(2) jackrabbit | ||
(3) ratest | ||
(4) slinp_test | ||
(5) slinptest | ||
(6) sulucmf | ||
|
||
Enter profile number: [] | ||
|
||
To explicitly use a profile use the `-p` option again: | ||
|
||
.. code-block:: bash | ||
|
||
$ phpcrsh --profile ratest | ||
# or | ||
$ phpcrsh -pratest | ||
|
||
.. note:: | ||
|
||
A profile is only created if the ``transport`` option is set. | ||
|
||
Connect to an embedded PHPCR shell | ||
---------------------------------- | ||
|
||
This is the easiest way to connect if you have are developing a Symfony 2 application | ||
|
||
See :ref:`phpcrsh-installation-embedded-application`. | ||
|
||
You can then connect simply using: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console phpcr:shell | ||
|
||
And you can execute specific commands: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console phpcr:shell node:list /cms | ||
|
||
Queries or commands with options must be escapted due to limitations with the Symfony | ||
console component: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console phpcr:shell "SELECT * FROM [nt:unstructured]" | ||
$ php app/console phpcr:shell "node:list -L2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
PHPCR-Shell | ||
=========== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
installation | ||
connecting |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
Installation | ||
============ | ||
|
||
You can install PHPCR Shell either as an embedded application or as a PHAR, or | ||
you can built it your self (for instance if you want the latest version). | ||
|
||
.. _phpcrsh-connecting-installation-as-phar: | ||
|
||
Install as a PHAR | ||
----------------- | ||
|
||
The latest release can be downloaded from the `Github releases page | ||
<https://github.com/doctrine/DoctrinePHPCRBundle/>`_. | ||
|
||
After downloading it it is recommended to install it in a path accessible | ||
by the system, for example: | ||
|
||
.. code-block:: bash | ||
|
||
$ sudo mv phpcrsh.sh /usr/local/bin/phpcrsh | ||
$ sudo chmod a+x /usr/local/bin/phpcrsh | ||
|
||
You can now run PHPCRSH from anywhere: | ||
|
||
.. code-block:: bash | ||
|
||
$ phpcrsh --help | ||
|
||
.. _phpcrsh-installation-embedded-application: | ||
|
||
Install as an embedded application | ||
---------------------------------- | ||
|
||
If you are using a Symfony2 application and the `DoctrinePHPCRBundle <https://github.com/doctrine/DoctrinePHPCRBundle/>`_ | ||
then you can easily integrate the PHPCR-Shell. | ||
|
||
Simply add the shell to your ``composer.json`` file | ||
|
||
.. code-block:: javascript | ||
|
||
{ | ||
... | ||
require: { | ||
... | ||
"phpcr-shell": "<lastest version here>" | ||
} | ||
... | ||
} | ||
|
||
And you can connect directly: | ||
|
||
.. code-block:: bash | ||
|
||
$ php app/console phpcr:shell | ||
|
||
Build it from source | ||
-------------------- | ||
|
||
PHPSH uses the box PHAR building tool, install it `here <http://box-project.org>`_. | ||
|
||
Build the PHAR: | ||
|
||
.. code-block:: bash | ||
|
||
$ cd phpcr-shell | ||
$ box build | ||
|
||
This will produce the file ``phpcr.phar``, see :ref:`phpcrsh-connecting-installation-as-phar` for | ||
further instructions. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should say: "DoctrinePHPCRBundle version 1.2 or newer"