PHPackages                             monkeyscloud/monkeyslegion-dev-server - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. monkeyscloud/monkeyslegion-dev-server

ActiveLibrary[CLI &amp; Console](/categories/cli)

monkeyscloud/monkeyslegion-dev-server
=====================================

Hot-reload development server for MonkeysLegion applications.

1.0.3(5mo ago)01.1k↑142.9%2MITPHPPHP ^8.4

Since Jul 23Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/MonkeysCloud/MonkeysLegion-Dev-Server)[ Packagist](https://packagist.org/packages/monkeyscloud/monkeyslegion-dev-server)[ RSS](/packages/monkeyscloud-monkeyslegion-dev-server/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (5)Used By (2)

MonkeysLegion Dev Server
========================

[](#monkeyslegion-dev-server)

A lightweight, hot-reload development server for MonkeysLegion applications. Built on PHP's native web server with automatic file watching and zero configuration.

Features
--------

[](#features)

- 🚀 **Zero Configuration** - Works out of the box with MonkeysLegion projects
- 🔥 **Hot Reload** - Automatic restart on file changes (two methods available)
    - 🎯 **entr** - External file watcher (recommended, most efficient)
    - 🔄 **FileWatcher** - Built-in pure PHP watcher (zero external dependencies)
- ⚡ **Fast** - Uses PHP's built-in server with opcache disabled for instant updates
- 🎯 **Simple CLI** - Easy commands: `start`, `stop`, `restart`, `status`
- 🛡️ **Process Management** - Robust PID tracking with fallback mechanisms
- 📁 **Smart Routing** - Serves static files and routes dynamic requests to your app
- 🔧 **Flexible** - Customizable host, port, and document root
- 💪 **No External Dependencies** - Works with pure PHP, `entr` is optional

Requirements
------------

[](#requirements)

- PHP 8.0 or higher
- POSIX extension (included in most PHP installations)
- `entr` for efficient hot-reload (optional, automatic fallback to pure PHP watcher)

### Installing entr

[](#installing-entr)

```
# Ubuntu/Debian
sudo apt-get install entr

# macOS
brew install entr

# Fedora/RHEL
sudo dnf install entr
```

Installation
------------

[](#installation)

### Via Composer (Recommended)

[](#via-composer-recommended)

```
composer require --dev monkeyscloud/monkeyslegion-dev-server
```

### Manual Installation

[](#manual-installation)

1. Clone or download this package to your project's `vendor` directory
2. Ensure the autoloader is configured correctly
3. Copy the `bin/dev-server` script to your project's `bin/` directory

Quick Start
-----------

[](#quick-start)

```
# Start the server (default: http://127.0.0.1:8000)
./vendor/bin/dev-server

# Or if copied to your bin/ directory
./bin/dev-server
```

That's it! Your MonkeysLegion app is now running with hot-reload enabled.

Usage
-----

[](#usage)

### Basic Commands

[](#basic-commands)

```
# Start server on default host:port (127.0.0.1:8000)
./bin/dev-server
./bin/dev-server start

# Start on custom host and port
./bin/dev-server 0.0.0.0 3000

# Stop the server
./bin/dev-server stop

# Restart the server
./bin/dev-server restart

# Restart on custom host:port
./bin/dev-server restart 0.0.0.0 3000

# Check server status
./bin/dev-server status

# Show help
./bin/dev-server help
```

### Environment Variables

[](#environment-variables)

You can set default host and port via environment variables:

```
# In your .env or shell profile
export ML_DEV_HOST=0.0.0.0
export ML_DEV_PORT=3000

# Now just run:
./bin/dev-server
```

### Programmatic Usage

[](#programmatic-usage)

```
