Skip to content

Instantly share code, notes, and snippets.

@iamdanre
Last active October 6, 2024 10:48
Show Gist options
  • Save iamdanre/771c67c62cbfd734f587fb9a58a2766a to your computer and use it in GitHub Desktop.
Save iamdanre/771c67c62cbfd734f587fb9a58a2766a to your computer and use it in GitHub Desktop.
MAMP index file, shows sites, mongoDB status, Mailpit status and phpInfo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>localhost</title>
<style>
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-color: #282c34;
color: #ffffff;
}
header {
text-align: center;
padding: 20px 0;
margin: 0;
}
.container {
width: 90%;
margin: 0 auto;
max-width: 1200px;
}
.flex-container {
display: flex;
flex-wrap: wrap;
margin: 20px 0;
}
.flex-item {
flex: 1 1 30%;
margin: 0.5%;
}
.btn {
display: flex;
justify-content: center;
align-items: center;
padding: 10px 15px;
color: #ffffff;
text-decoration: none;
border: 2px solid #ffffff;
border-radius: 5px;
transition: background-color 0.3s, color 0.3s;
background-color: #343a40;
}
.btn:hover {
background-color: #1c1f24;
color: #ffffff;
}
.alert {
padding: 10px 15px;
margin: 10px 0;
border-radius: 5px;
color: #ffffff;
}
.alert-success {
background-color: #28a745;
}
.alert-danger {
background-color: #dc3545;
}
</style>
</head>
<body>
<header class="container">
<h1>MAMP Sites</h1>
</header>
<main class="container">
<div class="flex-container">
<?php
$dir = '/Applications/MAMP/htdocs';
$sites = scandir($dir);
$sites = array_diff($sites, ['..', '.', '.DS_Store', 'index.php']);
foreach ($sites as $site) {
echo "<div class='flex-item'><a href='$site/public_html' class='btn'>$site</a></div>";
}
?>
</div>
<div class="flex-container">
<div class="flex-item">
<a href="/phpmyadmin" class="btn">phpMyAdmin</a>
</div>
<div class="flex-item">
<a href="/MAMP/opcache.php" class="btn">OPcache</a>
</div>
</div>
<?php
$output = shell_exec('pgrep mongod');
if ($output) {
echo "<div class='alert alert-success'>MongoDB is running</div>";
} else {
echo "<div class='alert alert-danger'>MongoDB is not running</div>";
}
$output = shell_exec('pgrep mailpit');
if ($output) {
echo "<div class='alert alert-success'>Mailpit is running</div>";
} else {
echo "<div class='alert alert-danger'>Mailpit is not running</div>";
}
phpinfo();
?>
</main>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment