clickalicious/webserverdaemon

Small utility to demonize PHP's internal webserver.

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

This package is not auto-updated.

Last update: 2024-12-19 07:44:07 UTC


README

Logo of webserver-daemon

Small utility to demonize PHP's internal webserver.

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!

Sponsors

Thanks to our sponsors and supporters:

Copyright
Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY