Skip to content

Commit 20b6295

Browse files
authored
Merge pull request #20 from php-school/only-add-update-commands-when-in-phar
Only add update & rollback commands when in phar mode
2 parents f7ad025 + 0847bae commit 20b6295

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,29 @@ A tool to manage your PHP School workshops. Search, install, update & remove wor
2222

2323
## Installation
2424

25+
### Phar
26+
27+
This is the recommended installation method.
28+
2529
```
2630
curl https://php-school.github.io/workshop-manager/workshop-manager.phar
2731
mv workshop-manager.phar /usr/local/bin/workshop-manager
2832
chmod +x /usr/local/bin/workshop-manager
2933
workshop-manager verify
3034
```
3135

36+
### Composer
37+
38+
If you install the workshop-manager via composer you will need to make sure that you don't have conflicting dependencies
39+
with other globally installed tools. Also you will need to be able to use the self-update and rollback commands.
40+
41+
You will need to make sure that your composer global bin directory is available in your $PATH environment variable.
42+
43+
```
44+
composer global require php-school/workshop-manager
45+
workshop-manager verify
46+
```
47+
3248
This snippet downloads the phar package (an executable PHP package) and moves it to a common install directory, makes it executable and then runs the workshop manager's verify command. You should see some green success messages if everything went will.
3349

3450

app/config.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,14 @@
4646
->setDescription('Search for a PHP School workshop.');
4747
$application->command('installed', ListWorkshops::class, ['show'])
4848
->setDescription('List installed PHP School workshops.');
49-
$application->command('self-update', SelfUpdate::class)
50-
->setDescription('Update the workshop manager to the latest version.');
51-
$application->command('rollback', SelfRollback::class)
52-
->setDescription('Rollback the workshop manager to the previous version.');
49+
50+
if (extension_loaded('phar') && Phar::running()) {
51+
$application->command('self-update', SelfUpdate::class)
52+
->setDescription('Update the workshop manager to the latest version.');
53+
$application->command('rollback', SelfRollback::class)
54+
->setDescription('Rollback the workshop manager to the previous version.');
55+
}
56+
5357
$application->command('verify', VerifyInstall::class, ['validate'])
5458
->descriptions('Verify your installation is working correctly');
5559

0 commit comments

Comments
 (0)