clickalicious/webserverdaemon

Small utility to demonize PHP's internal webserver.

v1.0.0 2017-05-02 05:23 UTC

README

26927954?v=3&s=80

Logo of webserver-daemon

Small utility to demonize PHP's internal webserver.

Build Status Codacy branch grade Codacy coverage clickalicious open source
GitHub release license Issue Stats Dependency Status

Table of Contents

Features

  • Demonize PHP's internal webserver by sending process to background
  • Without nohup dependency
  • Control webserver with well known start, stop, restart & status command
  • Simple PID- and Logfile abstraction
  • Multi process support
  • High-quality & stable codebase (following PSR standards e.g. PSR-1,2,4)
  • Built on top of good PHP libraries
  • Clean + well documented code
  • Unit-tested with a good coverage

Example

We provided some examples in the directory "demo" on How-To use the library and wrapper around PHP's internal webserver:

PHP

An example on how to use the library in PHP context:

<?php
 
// Create an instance of PHP's internal webserver
$webserverDaemon = new \Clickalicious\Webserver\Daemon\Demonize(
    $interface,
    $port,
    $documentRoot,
    $uid,
    $phpBinary,
    $tempDir
);

// Daemon control
$webserverDaemon->start();
$webserverDaemon->restart();
$webserverDaemon->stop();

// Get PID
$webserverDaemon->start();
$webserverDaemon->getPid();

Start

The following simple example shows how the daemon can be started: Demo START daemon »

Use this command for execution of the demo:

$> php demo/start.php

Stop

The following simple example shows how the daemon can be stopped: Demo STOP daemon »

Use this command for execution of the demo:

$> php demo/stop.php

Restart

The following simple example shows how the daemon can be restarted: Demo RESTART daemon »

Use this command for execution of the demo:

$> php demo/restart.php

Status

The following simple example shows how the status of the daemon can be queried: Demo STATUS daemon »

Use this command for execution of the demo:

$> php demo/status.php

Requirements

  • PHP >= 5.6 (compatible up to version 7.2 as well as HHVM)

Philosophy

This library provides the functionality to daemonize PHP's internal webserver and send the process to background without blocking the console or process starting the internal webserver.

Versioning

For a consistent versioning i decided to make use of Semantic Versioning 2.0.0 http://semver.org. Its easy to understand, very common and known from many other software projects.

Roadmap

  • Target stable release 1.0.0
  • >= 90% test coverage

Throughput Graph

Security Issues

If you encounter a (potential) security issue don't hesitate to get in contact with us opensource@clickalicious.de before releasing it to the public. So i get a chance to prepare and release an update before the issue is getting shared. Thank you!

Participate & Share

... yeah. If you're a code monkey too - maybe we can build a force ;) If you would like to participate in either Code, Comments, Documentation, Wiki, Bug-Reports, Unit-Tests, Bug-Fixes, Feedback and/or Critic then please let me know as well! 687474703a2f2f6a70696c6c6f72612e636f6d2f6769746875622d747769747465722d627574746f6e2f696d672f74776565742e706e67

Sponsors

Thanks to our sponsors and supporters:

JetBrains Navicat
68747470733a2f2f7265736f75726365732e6a6574627261696e732e636f6d2f6173736574732f6d656469612f6f70656e2d67726170682f6a6574627261696e735f323530783235302e706e67 687474703a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f656e2f392f39302f5072656d69756d536f66745f4e6176696361745f5072656d69756d5f4c6f676f2e706e67
Copyright
Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY