https://github.com/mbpcoder/devlet
DevLet is a local Apache vhost manager for PHP projects. It auto-detects domain and PHP version (from .devlet or composer.json), creates SSL configs using mkcert, updates /etc/hosts, and enables required Apache modules โ perfect for WSL and Linux dev environments.
https://github.com/mbpcoder/devlet
Last synced: 5 months ago
JSON representation
DevLet is a local Apache vhost manager for PHP projects. It auto-detects domain and PHP version (from .devlet or composer.json), creates SSL configs using mkcert, updates /etc/hosts, and enables required Apache modules โ perfect for WSL and Linux dev environments.
- Host: GitHub
- URL: https://github.com/mbpcoder/devlet
- Owner: mbpcoder
- Created: 2025-07-26T17:49:44.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-07-27T09:21:44.000Z (11 months ago)
- Last Synced: 2025-07-27T09:31:07.030Z (11 months ago)
- Language: PHP
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DevLet โ Local Development Environment Auto-Configurator
**DevLet** is a PHP-based CLI tool built for Laravel Artisan that automates the configuration of local development environments using Apache, SSL (via mkcert), and PHP-FPM.
It streamlines developer onboarding by managing domain setup, certificate generation, and system-level configuration based on a per-project `.devlet` file or `composer.json` fallback.
---
## ๐ Features
- ๐ **Project Auto-Discovery** โ Scans source directories to detect Laravel or PHP projects
- ๐งพ **`.devlet` Support** โ Define project-specific domain and PHP version
- ๐ฆ **Composer Integration** โ Parses `composer.json` to extract PHP version if `.devlet` is missing
- ๐ **SSL Certificates with mkcert** โ Automatically generates trusted certificates for each domain (supports WSL)
- ๐ **Apache VirtualHost Generator** โ Generates VHost files with full PHP-FPM, SSL, redirect support
- ๐ **/etc/hosts Sync** โ Adds domain entries to the local `/etc/hosts` file
- โช๏ธ **www to non-www Redirects** โ Auto-redirect `www.domain` to `domain` securely over HTTPS
- ๐งฉ **Laravel 12 Artisan Commands** โ Modular Laravel Artisan command structure
---
## ๐ Example `.devlet` File
Define custom domain and PHP version per project:
```ini
domain=api.local
php=8.2
```
If this file is missing, DevLet will fallback to `composer.json` and extract `"php": "^8.2"` from `require`.
---
## ๐งช Example Apache VHost (Generated)
```apache
ServerName api.local
ServerAlias www.api.local
Redirect permanent / https://api.local/
ServerName api.local
ServerAlias www.api.local
DocumentRoot "/home/user/Projects/api/public"
SSLEngine on
SSLCertificateFile /etc/ssl/certs/api.local.pem
SSLCertificateKeyFile /etc/ssl/private/api.local-key.pem
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost/"
AllowOverride All
Require all granted
ErrorLog ${APACHE_LOG_DIR}/api.local-error.log
CustomLog ${APACHE_LOG_DIR}/api.local-access.log combined
```
---
## ๐งฐ Available Artisan Commands
### ๐ ๏ธ `devlet:os-install`
Installs necessary packages based on `config/devlet.php`.
Handles PHP, Apache, SSL tools, and more.
### โ
`devlet:os-verify`
Verifies required software and system configuration.
### โ๏ธ `devlet:configure`
Auto-configures VHosts, SSL, hosts file, and PHP-FPM mappings.
---
## ๐ง How It Works
1. Scan all project directories (from config)
2. Parse `.devlet` or fallback to `composer.json`
3. Normalize and generate domain names
4. Create and trust SSL certificates (even under WSL)
5. Write Apache config files using Laravel stubs
6. Enable site, reload Apache
7. Update `/etc/hosts` file
---
## ๐ Configurable via `config/devlet.php`
- Project source directories
- Default PHP fallback version
- Apache vhost path
- SSL cert locations
- Auto-reload flags
---
## ๐ชช Notes
- DevLet is strictly for **local development**
- Certificates are stored in `/etc/ssl/certs/` and `/etc/ssl/private/`
- Apache configs are prefixed with `devlet-`
- Auto-cleanup stale configs when projects are removed
---
## ๐ค Contributing
Pull requests, ideas, and improvements are welcome!
---
## ๐ License
MIT License ยฉ Your Name