1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 03:50:08 +02:00

Update README, check for broken formulae

This commit is contained in:
2023-05-14 11:47:35 +02:00
parent ab993efbde
commit c7ee4b8838
8 changed files with 52 additions and 14 deletions

View File

@ -25,15 +25,14 @@ PHP Monitor is a universal application that runs natively on Apple Silicon **and
* macOS 12.4 or later (Monterey and Ventura are supported) * macOS 12.4 or later (Monterey and Ventura are supported)
* Homebrew is installed in `/usr/local/homebrew` or `/opt/homebrew` * Homebrew is installed in `/usr/local/homebrew` or `/opt/homebrew`
* Homebrew `php` formula is installed * Homebrew `php` formula is installed
* Laravel Valet (works with Valet v2, v3 and v4)
_You may need to update your Valet installation to keep everything working if a major version update of PHP has been released. You can do this by running `composer global update && valet install`. Some features are not supported when running Valet 2._ _Starting with PHP Monitor 6.0, you do not need to have Laravel Valet installed for PHP Monitor to work. To get access to all features of PHP Monitor however, installing Valet is **recommended**._
For more information, please see [SECURITY.md](./SECURITY.md) to find out which version of the app is currently supported. For more information, please see [SECURITY.md](./SECURITY.md) to find out which version of the app is currently supported.
## 🚀 How to install ## 🚀 How to install
Again, make sure you have **[Laravel Valet](https://laravel.com/docs/master/valet)** installed first: Again, if you want to have access to *all features* of PHP Monitor, I recommend installing **[Laravel Valet](https://laravel.com/docs/master/valet)** first:
```sh ```sh
composer global require laravel/valet composer global require laravel/valet
@ -41,6 +40,8 @@ valet install
valet trust valet trust
``` ```
Currently, PHP Monitor is compatible with Laravel Valet v2, v3 and v4. Each of these versions of Valet support slightly different PHP versions, which is why legacy versions remain supported. Please note that some features are not available in older versions of Valet, like site isolation.
#### Manual installation (recommended, first time only) #### Manual installation (recommended, first time only)
Once that's done, you can [download the latest release](https://github.com/nicoverbruggen/phpmon/releases/latest), unzip it and place it in `/Applications`. Once that's done, you can [download the latest release](https://github.com/nicoverbruggen/phpmon/releases/latest), unzip it and place it in `/Applications`.
@ -126,7 +127,9 @@ If you encounter a strange scenario or a malfunction, please open an issue on th
<details> <details>
<summary><strong>I want PHP Monitor to start up when I boot my Mac!</strong></summary> <summary><strong>I want PHP Monitor to start up when I boot my Mac!</strong></summary>
You can do this by dragging *PHP Monitor.app* into the **Login Items** section in **System Preferences > Users & Groups** for your account. If you are running macOS Ventura or newer, there's an option in the Settings menu that you can select: "Start PHP Monitor at login".
If you are on an older version of macOS, you can do this by dragging *PHP Monitor.app* into the **Login Items** section in **System Preferences > Users & Groups** for your account.
Super convenient! Super convenient!
</details> </details>

View File

@ -135,6 +135,21 @@ class Startup {
descriptionText: "startup.errors.php_binary.desc".localized(Paths.php) descriptionText: "startup.errors.php_binary.desc".localized(Paths.php)
), ),
// ================================================================================= // =================================================================================
// Ensure that the main PHP installation is not broken.
// =================================================================================
EnvironmentCheck(
command: {
return await Shell.pipe("\(Paths.binPath)/php -v").err
.contains("Library not loaded")
},
name: "`no dyld issue detected",
titleText: "startup.errors.dyld_library.title".localized,
subtitleText: "startup.errors.dyld_library.subtitle".localized(
Paths.optPath
),
descriptionText: "startup.errors.dyld_library.desc".localized
),
// =================================================================================
// The Valet binary must exist. // The Valet binary must exist.
// ================================================================================= // =================================================================================
EnvironmentCheck( EnvironmentCheck(

View File

@ -49,6 +49,12 @@ struct BrewFormula {
return VersionNumber.make(from: version)?.short ?? nil return VersionNumber.make(from: version)?.short ?? nil
} }
/// A quick variable that you can check to see if the install is unhealthy.
/// Will report true if no health information is available.
var healthy: Bool {
return isHealthy() ?? true
}
/** /**
* Determines if this PHP installation is healthy. * Determines if this PHP installation is healthy.
* Uses the cached installation health check as basis. * Uses the cached installation health check as basis.

View File

@ -72,4 +72,5 @@ class StatusMenu: NSMenu {
addCoreMenuItems() addCoreMenuItems()
} }
// swiftlint:enable cyclomatic_complexity
} }

View File

@ -65,6 +65,7 @@ class MenuStructurePreferencesVC: GenericPreferenceVC {
return vc return vc
} }
// swiftlint:enable line_length
} }
class NotificationPreferencesVC: GenericPreferenceVC { class NotificationPreferencesVC: GenericPreferenceVC {

View File

@ -196,6 +196,7 @@ struct Preset: Codable, Equatable {
+ info + "</i>" + info + "</i>"
+ "</span>" + "</span>"
} }
// swiftlint:enable void_function_in_ternary
// MARK: - Reverting // MARK: - Reverting

View File

@ -137,16 +137,6 @@ struct PhpFormulaeView: View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text(formula.displayName).bold() Text(formula.displayName).bold()
/*
if formula.isHealthy() == nil {
Text("Unknown health")
} else {
Text(formula.isHealthy()! ? "Health OK" : "Broken!")
}
Text(formula.homebrewFolder)
*/
if formula.isInstalled && formula.hasUpgrade { if formula.isInstalled && formula.hasUpgrade {
Text("\(formula.installedVersion!) installed, \(formula.upgradeVersion!) available.") Text("\(formula.installedVersion!) installed, \(formula.upgradeVersion!) available.")
.font(.system(size: 11)) .font(.system(size: 11))
@ -159,6 +149,12 @@ struct PhpFormulaeView: View {
.font(.system(size: 11)) .font(.system(size: 11))
.foregroundColor(.gray) .foregroundColor(.gray)
} }
if !formula.healthy {
Text("This PHP installation is broken.")
.font(.system(size: 11))
.foregroundColor(.red)
}
} }
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
@ -212,6 +208,14 @@ struct PhpFormulaeView: View {
} }
} }
public func repairAll() async {
await self.runCommand(InstallAndUpgradeCommand(
title: "Repairing installations...",
upgrading: [],
installing: []
))
}
public func upgradeAll(_ formulae: [BrewFormula]) async { public func upgradeAll(_ formulae: [BrewFormula]) async {
await self.runCommand(InstallAndUpgradeCommand( await self.runCommand(InstallAndUpgradeCommand(
title: "Installing updates...", title: "Installing updates...",
@ -321,6 +325,7 @@ struct PhpFormulaeView: View {
} }
} }
} }
// swiftlint:enable type_body_length
struct PhpFormulaeView_Previews: PreviewProvider { struct PhpFormulaeView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {

View File

@ -574,6 +574,12 @@ You can do this by running `composer global update` in your terminal. After that
"startup.errors.php_opt.subtitle" = "The PHP alias was not found in `%@`. The app will not work correctly until you resolve this issue."; "startup.errors.php_opt.subtitle" = "The PHP alias was not found in `%@`. The app will not work correctly until you resolve this issue.";
"startup.errors.php_opt.desc" = "If you already have the `php` formula installed, you may need to run `brew install php` in order for PHP Monitor to detect this installation."; "startup.errors.php_opt.desc" = "If you already have the `php` formula installed, you may need to run `brew install php` in order for PHP Monitor to detect this installation.";
/// PHP binary is broken
"startup.errors.dyld_library.title" = "PHP is installed, but appears to be broken";
"startup.errors.dyld_library.subtitle" = "When PHP Monitor is attempting to run commands, it is failing to do so correctly. This is usually an indicator of a broken PHP installation.";
"startup.errors.dyld_library.desc" = "Running `brew reinstall php && brew link php` in your Terminal may resolve this issue, so please give that a try.";
/// Valet is not installed
"startup.errors.valet_executable.title" = "Laravel Valet is not correctly installed"; "startup.errors.valet_executable.title" = "Laravel Valet is not correctly installed";
"startup.errors.valet_executable.subtitle" = "You must install Valet with Composer. The app will not work correctly until you resolve this issue."; "startup.errors.valet_executable.subtitle" = "You must install Valet with Composer. The app will not work correctly until you resolve this issue.";
"startup.errors.valet_executable.desc" = "If you haven't installed Laravel Valet yet, please do so first. If you have it installed but are seeing this message anyway, then try running `which valet` in Terminal, it should return: `%@`."; "startup.errors.valet_executable.desc" = "If you haven't installed Laravel Valet yet, please do so first. If you have it installed but are seeing this message anyway, then try running `which valet` in Terminal, it should return: `%@`.";