Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 31201aa

Browse files
authored
New syntax description
1 parent 0c862f3 commit 31201aa

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

README.md

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class DummyCommand extends Command
6060
}
6161
```
6262

63-
### 3. Create or edit config section in projects composer.json and add there section `commands` with PHP class names of commands that should be added to composer
63+
### 3. Create or edit config section in projects composer.json and add there section `custom-commands` with `commands` key and add there PHP class names of commands that should be added to composer
6464

6565
This should look something like this:
6666
```javascript
@@ -84,9 +84,45 @@ This should look something like this:
8484
}
8585
},
8686
"extra": {
87-
"commands": [
88-
"My\\Commands\\DummyCommand"
89-
]
87+
"custom-commands": {
88+
"commands": [
89+
"My\\Commands\\DummyCommand"
90+
]
91+
}
92+
}
93+
}
94+
```
95+
96+
If you need that some script should be executed before every command (f.e. you need to define some constants), you can add there `boot` key with value that is filename relative from place where composer.json is.
97+
98+
In that case your composer.json should look similar to this:
99+
```javascript
100+
{
101+
"name": "my-project",
102+
"description": "",
103+
"type": "project",
104+
"require": {
105+
"imponeer/composer-custom-commands": "*"
106+
},
107+
"license": "MIT",
108+
"authors": [
109+
{
110+
"name": "SomeBody SomeOne",
111+
"email": "internet@is.ours.com"
112+
}
113+
],
114+
"autoload": {
115+
"psr-4": {
116+
"My\\": "src/"
117+
}
118+
},
119+
"extra": {
120+
"custom-commands": {
121+
"commands": [
122+
"My\\Commands\\DummyCommand"
123+
],
124+
"boot": "boot.php"
125+
}
90126
}
91127
}
92128
```

0 commit comments

Comments
 (0)