PHPackages                             adrian0350/php-daemon - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. adrian0350/php-daemon

ActiveLibrary[Queues &amp; Workers](/categories/queues)

adrian0350/php-daemon
=====================

Bring workers to your web projects using PHP!

1.3.4(8y ago)146MITPHPPHP &gt;=5.3.0

Since Sep 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Adrian0350/PHPDaemon)[ Packagist](https://packagist.org/packages/adrian0350/php-daemon)[ Docs](https://github.com/Adrian0350/PHPDaemon)[ RSS](/packages/adrian0350-php-daemon/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (11)Used By (0)

Introduction
============

[](#introduction)

With PHPDaemon you'll be able to run simple one-time daemons in any case you find yourself in a situation where you need to run an external script, meaning you need a Helper in your web project or what not.

This class works by storing a pid **inside** your script's dir as `.script_file.pid` (files starting wiht `.` are hidden by default).

Script output (logging) will be set in `$options` with the keys `(boolean) log` and `(string) log_path`.

If `log` is set to true and no `log_path` is provided or is invalid it will log in the script's directory.

If `log` is set to true and `log_path` is provided and valid it will log into the given log\_path.

**Log's name will be your `script_file` name ending with `.log`**.

**Example:**For the **pid** `/your/daemon/path/to/script_file.php` would be `/your/daemon/path/to/.script_file.php.pid`and for the **log** `/your/daemon/path/to/script_file.php` without a log\_path, it would be `/your/daemon/path/to/script_file.php.log`.

### PHP Version

[](#php-version)

This class is compatible with **PHP 5.4 and above** due to the use of namespaces and PHP\_BINARY constant.

### Installing

[](#installing)

Add this library to your [composer](https://packagist.org/packages/adrian0350/php-daemon) configuration. In composer.json:

```
  "require": {
    "adrian0350/php-daemon": "1.*"
  }
```

#### OR

[](#or)

If you're using bash.

```
$ composer require adrian0350/php-daemon

```

### Usage

[](#usage)

For usage just call the methods from your PHPDaemon instance object.

```
