Skip to content

Commit 4a4653f

Browse files
authored
Better Configuration Documentation (phpactor#359)
* Added configuration documentation * RPC replay config
1 parent b64e173 commit 4a4653f

File tree

3 files changed

+156
-29
lines changed

3 files changed

+156
-29
lines changed

couscous.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ menu:
3030
vim-plugin:
3131
text: VIM plugin
3232
relativeUrl: vim-plugin.html
33+
configuration:
34+
text: Configuration
35+
relativeUrl: configuration.html
3336
reference:
3437
name: Reference
3538
items:

doc/configuration.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
---
2+
currentMenu: configuration
3+
---
4+
Configuration
5+
=============
6+
7+
Configuration files are loaded from your current directory, and then from the
8+
XDG standard user and system directories, for example:
9+
10+
- `/home/daniel/www/phpactor/phpactor/.phpactor.yml`
11+
- `/home/daniel/.config/phpactor/phpactor.yml`
12+
- `/etc/xdg/phpactor/phpactor.yml`
13+
14+
Phpactor will merge configuration files, with more specific configurations
15+
overriding the less specific ones.
16+
17+
Config Dump
18+
-----------
19+
20+
Use the `config:dump` command to show the currently loaded configuration files
21+
and all of the current settings:
22+
23+
```bash
24+
$ phpactor config:dump
25+
Config files:
26+
[✔] /home/daniel/workspace/myproject/.phpactor.yml
27+
[✔] /home/daniel/.config/phpactor/phpactor.yml
28+
[𐄂] /etc/xdg/phpactor/phpactor.yml
29+
30+
code_transform.class_new.variants:
31+
exception:exception
32+
autoload:vendor/autoload.php
33+
34+
# ... etc
35+
```
36+
37+
Reference
38+
---------
39+
40+
### Core
41+
42+
#### autoload
43+
44+
*Default*: `vendor/autoload.php`
45+
46+
Phpactor will automatically look to see if it can use the
47+
[composer](https://getcomposer.org) autoloader at this
48+
path. The autoloader helps Phpactor locate classes.
49+
50+
#### autoload.deregister
51+
52+
*Default*: `true`
53+
54+
By default Phpactor will deregister the included autoloader to prevent
55+
any potential conflicts. However, some autoloaders may add global dependencies
56+
on the code available through that autoloader (e.g. Drupal). In such cases
57+
set this to `false` and hope that everything is *fine*.
58+
59+
#### cache_dir
60+
61+
Directory Phpactor uses for the cache (e.g. the PhpStorm stub index).
62+
63+
#### logging.enabled
64+
65+
*Default*: `false`
66+
67+
Phpactor can log information, notably RPC requests and responses in addition
68+
to other debug information.
69+
70+
#### logging.fingers_crossed
71+
72+
*Default*: `false`
73+
74+
If set to `true` only log when an error occurs, but when an error does occur
75+
include all the log levels.
76+
77+
#### logging.level
78+
79+
*Default*: `DEBUG`
80+
81+
The default logging level.
82+
83+
#### logging.path
84+
85+
*Default*: `phpactor.log`
86+
87+
Where the log file is
88+
89+
### Code Transform Extension
90+
91+
#### code_transform.class_new.variants
92+
93+
```
94+
code_transform.class_new.variants:
95+
exception: exception
96+
symfony_command: symfony_command
97+
```
98+
99+
The variants available when generating new classes. The name of the variant
100+
should match a directory in a `templates` directory, e.g.:
101+
102+
```
103+
<your project root>/.phpactor/templates/
104+
exception/
105+
SourceCode.php.twig
106+
```
107+
108+
or any of the XDG directories (e.g. `$HOME/.config/phpactor/templates`).
109+
110+
#### code_transform.template_paths
111+
112+
*Default*: `<xdg paths>/templates` and local project `.phpactor/templates`
113+
114+
Directories where class templates can be located.
115+
116+
### Navigator Extension
117+
118+
#### navigator.destinations
119+
120+
The navigator allows navigation between different aspects of the source code
121+
(e.g. source and tests). A simple configuration would look as follows:
122+
123+
```
124+
navigator.destinations:
125+
source:lib/<kernel>.php
126+
unit_test:tests/Unit/<kernel>Test.php
127+
```
128+
129+
This would enable you to jump (`context menu > navigate`) from
130+
`lib/Acme/Post.php` to `tests/Unit/Acme/Post.php`.
131+
132+
#### navigator.autocreate
133+
134+
If a navigator destination doesn't exist, you can automatically create them
135+
using a one of the `code_transform.class_new_variants`:
136+
137+
```
138+
code_transform.class_new.variants:
139+
source: default
140+
unit_test: phpunit_test
141+
exception:exception
142+
symfony_command:symfony_command
143+
```
144+
145+
### RPC Extension
146+
147+
#### rpc.store_replay
148+
149+
*Default*: `false`
150+
151+
The `rpc` command can replay the last request (useful when debugging an RPC
152+
client). For this to work enable this flag so that the requests are stored in
153+
a temporary location.

doc/standalone.md

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -54,32 +54,3 @@ $ phpactor status
5454
✔ Composer detected - faster class location and more features!
5555
✔ Git detected - enables faster refactorings in your repository scope!
5656
```
57-
58-
Configuration
59-
-------------
60-
61-
Phpactor is configured with a YAML file. You can dump the configuration using the `config:dump` command.
62-
63-
```bash
64-
$ phpactor config:dump
65-
Config files:
66-
[✔] /home/daniel/www/phpactor/phpactor/.phpactor.yml
67-
[✔] /home/daniel/.config/phpactor/phpactor.yml
68-
[𐄂] /etc/xdg/phpactor/phpactor.yml
69-
70-
code_transform.class_new.variants:
71-
exception:exception
72-
autoload:vendor/autoload.php
73-
74-
# ... etc
75-
```
76-
77-
Note the `Config files` section above. This is a list of config files that
78-
Phpactor has attempted to load:
79-
80-
- From the current directory.
81-
- From the users home directory.
82-
- From the systems configuration directory.
83-
84-
Phpactor will merge configuration files, with more specific configurations
85-
overriding the less specific ones.

0 commit comments

Comments
 (0)