You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PHP Monitor (or phpmon) is a lightweight macOS utility app that runs on your Mac and displays the active PHP version in your status bar.
4
6
5
7
It also gives you quick access to various useful functionality (like switching PHP versions, restarting services, accessing configuration files, and more).
@@ -12,7 +14,7 @@ It's also super convenient to and switch between versions.
12
14
13
15
## π₯ System requirements
14
16
15
-
* macOS 10.15 Catalina
17
+
* macOS 10.15 Catalina or higher (works on macOS 11 Big Sur)
informativeText:"You must install PHP via brew. Try running `which php` in Terminal, it should return `/usr/local/bin/php`. The app will not work correctly until you resolve this issue. (Usually `brew link php` resolves this issue.)"
30
+
informativeText:"You must install PHP via brew. Try running `which php` in Terminal, it should return `/usr/local/bin/php`. The app will not work correctly until you resolve this issue. (Usually `brew link php` resolves this issue.)",
informativeText:"PHP 7.4 alias was not found in `/usr/local/opt`. The app will not work correctly until you resolve this issue. If you already have the `php` formula installed, you may need to run `brew install [email protected]` in order for PHP Monitor to detect this installation."
37
+
informativeText:"PHP 7.4 alias was not found in `/usr/local/opt`. The app will not work correctly until you resolve this issue. If you already have the `php` formula installed, you may need to run `brew install [email protected]` in order for PHP Monitor to detect this installation.",
messageText:"Laravel Valet is not correctly installed",
30
-
informativeText:"You must install Valet with composer. Try running `which valet` in Terminal, it should return `/usr/local/bin/valet`. The app will not work correctly until you resolve this issue."
44
+
informativeText:"You must install Valet with composer. Try running `which valet` in Terminal, it should return `/usr/local/bin/valet`. The app will not work correctly until you resolve this issue.",
messageText:"Brew has not been added to sudoers.d",
36
-
informativeText:"You must run `sudo valet trust` to ensure Valet can start and stop services without having to use sudo every time. The app will not work correctly until you resolve this issue."
51
+
informativeText:"You must run `sudo valet trust` to ensure Valet can start and stop services without having to use sudo every time. The app will not work correctly until you resolve this issue.",
messageText:"Valet has not been added to sudoers.d",
42
-
informativeText:"You must run `sudo valet trust` to ensure Valet can start and stop services without having to use sudo every time. The app will not work correctly until you resolve this issue."
58
+
informativeText:"You must run `sudo valet trust` to ensure Valet can start and stop services without having to use sudo every time. The app will not work correctly until you resolve this issue.",
59
+
breaking:true
43
60
)
44
61
45
62
letservices=Shell.user.pipe("brew services list | grep php")
46
-
self.presentAlertOnMainThreadIf(
63
+
self.performEnvironmentCheck(
47
64
(services.countInstances(of:"started")>1),
48
65
messageText:"Multiple PHP services are active",
49
66
informativeText:"This can cause php-fpm to serve a more recent version of PHP than the one you'd like to see active. Please terminate all extra PHP processes."+
50
67
"\n\nThe easiest solution is to choose the option 'Force load latest PHP version' in the menu bar."+
51
68
"\n\nAlternatively, you can fix this manually. You can do this by running `brew services list` and running `sudo brew services stop [email protected]` (and use the version that applies)."+
52
69
"\n\nPHP Monitor usually handles the starting and stopping of these services, so once the correct version is the only PHP version running you should not have any issues. It is recommended to restart PHP Monitor once you have resolved this issue."+
53
-
"\n\nFor more information about this issue, please see the README.md file in the repository on GitHub."
70
+
"\n\nFor more information about this issue, please see the README.md file in the repository on GitHub.",
71
+
breaking:false
54
72
)
73
+
74
+
if(!self.failed){
75
+
success()
76
+
}
55
77
}
56
78
57
-
privatestaticfunc presentAlertOnMainThreadIf(
79
+
/**
80
+
* Perform an environment check. Will cause the application to terminate, if `breaking` is set to true.
81
+
*
82
+
* - Parameter condition: Condition to check for
83
+
* - Parameter messageText: Short description of what is wrong
84
+
* - Parameter informativeText: Expanded description of the environment check that failed
85
+
* - Parameter breaking: If the application should terminate afterwards
86
+
*/
87
+
privatefunc performEnvironmentCheck(
58
88
_ condition:Bool,
59
89
messageText:String,
60
-
informativeText:String
90
+
informativeText:String,
91
+
breaking:Bool
61
92
)
62
93
{
63
94
if(condition){
95
+
// Only breaking issues will cause the notification
96
+
if(breaking){
97
+
self.failed =true
98
+
}
64
99
DispatchQueue.main.async{
65
-
Alert.present(
100
+
// Present the information to the user
101
+
_ =Alert.present(
66
102
messageText: messageText,
67
103
informativeText: informativeText
68
104
)
105
+
// Only breaking issues will throw the extra retry modal
<!DOCTYPEplist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+
<plistversion="1.0">
4
+
<dict>
5
+
<key>ApplicationDescription</key>
6
+
<string>PHP Monitor is a tool that shows the active PHP version in your menu bar and gives you easy access to certain PHP service actions and config files.</string>
<string>PHP Monitor directly invokes Homebrew which contacts the NPM Registry.</string>
26
+
<key>DenyConsequences</key>
27
+
<string>If you deny these connections, PHP Monitor might not be able to complete its preset set of instructions, causing version switching to fail.</string>
28
+
</dict>
29
+
<dict>
30
+
<key>IsIncoming</key>
31
+
<false/>
32
+
<key>Host</key>
33
+
<string>github.com, api.github.com</string>
34
+
<key>NetworkProtocol</key>
35
+
<string>TCP</string>
36
+
<key>Port</key>
37
+
<string>443</string>
38
+
<key>Relevance</key>
39
+
<string>Essential</string>
40
+
<key>Purpose</key>
41
+
<string>PHP Monitor directly invokes Homebrew which contacts GitHub.</string>
42
+
<key>DenyConsequences</key>
43
+
<string>If you deny these connections, PHP Monitor might not be able to complete its preset set of instructions, causing version switching to fail.</string>
"ApplicationDescription" = "PHP Monitor is a tool that shows the active PHP version in your menu bar and gives you easy access to certain PHP service actions and config files.";
0 commit comments