Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lifo101/php-daemon
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0
Choose a base ref
...
head repository: lifo101/php-daemon
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 13 commits
  • 40 files changed
  • 3 contributors

Commits on Jul 7, 2022

  1. Copy the full SHA
    d41108c View commit details
  2. Fixed version constraints.

    lifo101 committed Jul 7, 2022
    Copy the full SHA
    3952416 View commit details

Commits on Sep 27, 2022

  1. add support for PHP 8

    Brendon committed Sep 27, 2022
    Copy the full SHA
    98b650e View commit details

Commits on Oct 10, 2022

  1. Merge pull request #27 from phuze/master

    Support for PHP 8
    lifo101 authored Oct 10, 2022
    Copy the full SHA
    6e50117 View commit details

Commits on Oct 11, 2022

  1. Removed PHP 5.x support.

    symfony components 4.4+ are now required.
    upgraded composer autoload namespace from psr-0 to psr-4 (and removed Lifo\Daemon subdir).
    Added typehints where appropriate.
    Refactored DaemonEvent::__construct() to not need Daemon parameter.
    Code cleanup.
    lifo101 committed Oct 11, 2022
    Copy the full SHA
    70560f0 View commit details

Commits on Oct 13, 2022

  1. Updates.

    more typehints.
    Replaced some Exception catches with Throwable.
    Removed STDERR constant from Daemon.php.
    lifo101 committed Oct 13, 2022
    Copy the full SHA
    63cfbae View commit details

Commits on Nov 8, 2022

  1. Copy the full SHA
    67ac6ab View commit details

Commits on Nov 10, 2022

  1. PHP8 tweaks.

    lifo101 committed Nov 10, 2022
    Copy the full SHA
    6f40182 View commit details

Commits on Nov 12, 2022

  1. PHP8 deprecation tweaks.

    Removed Serializable interface from Mediator\Call.
    lifo101 committed Nov 12, 2022
    Copy the full SHA
    c5722cf View commit details

Commits on Nov 14, 2022

  1. Copy the full SHA
    cfdf019 View commit details
  2. Updated README.md.

    lifo101 committed Nov 14, 2022
    Copy the full SHA
    0632bee View commit details
  3. Updated README.md.

    lifo101 committed Nov 14, 2022
    Copy the full SHA
    a12abfb View commit details

Commits on Jan 3, 2023

  1. Copy the full SHA
    495d0d9 View commit details
Showing with 1,033 additions and 1,272 deletions.
  1. +3 −3 README.md
  2. +8 −9 composer.json
  3. +2 −2 examples/src/Plugins/MemoryPlugin.php
  4. +3 −2 examples/src/SimpleTask/SimpleTask.php
  5. +261 −359 src/{Lifo/Daemon → }/Daemon.php
  6. +13 −13 src/{Lifo/Daemon → }/Event/DaemonEvent.php
  7. 0 src/{Lifo/Daemon → }/Event/ErrorEvent.php
  8. +54 −0 src/Event/GuidEvent.php
  9. +3 −11 src/{Lifo/Daemon → }/Event/LogEvent.php
  10. +36 −0 src/Event/PidEvent.php
  11. +4 −7 src/{Lifo/Daemon → }/Event/ReapedEvent.php
  12. +4 −11 src/{Lifo/Daemon → }/Event/SignalEvent.php
  13. +4 −11 src/{Lifo/Daemon → }/Event/StatsEvent.php
  14. +3 −1 src/{Lifo/Daemon → }/Exception/CleanErrorException.php
  15. +21 −16 src/{Lifo/Daemon → }/ExceptionsTrait.php
  16. +11 −8 src/{Lifo/Daemon → }/IPC/IPCInterface.php
  17. +74 −55 src/{Lifo/Daemon → }/IPC/SysV.php
  18. +0 −84 src/Lifo/Daemon/Event/GuidEvent.php
  19. +0 −49 src/Lifo/Daemon/Event/PidEvent.php
  20. +0 −37 src/Lifo/Daemon/Plugin/ProcessManagerInterface.php
  21. +0 −20 src/Lifo/Daemon/Task/SimpleTask.php
  22. +0 −22 src/Lifo/Daemon/Worker/SimpleWorker.php
  23. +16 −13 src/{Lifo/Daemon → }/LogTrait.php
  24. +105 −123 src/{Lifo/Daemon → }/Mediator/Call.php
  25. +6 −9 src/{Lifo/Daemon → }/Mediator/CallDiedException.php
  26. +147 −160 src/{Lifo/Daemon → }/Mediator/Mediator.php
  27. +10 −11 src/{Lifo/Daemon → }/OptionsTrait.php
  28. +11 −11 src/{Lifo/Daemon → }/Plugin/AbstractPlugin.php
  29. +7 −8 src/{Lifo/Daemon → }/Plugin/Lock/AbstractLock.php
  30. +11 −10 src/{Lifo/Daemon → }/Plugin/Lock/FileLock.php
  31. +13 −15 src/{Lifo/Daemon → }/Plugin/Lock/ShmLock.php
  32. +2 −2 src/{Lifo/Daemon → }/Plugin/PluginInterface.php
  33. +28 −29 src/{Lifo/Daemon → }/Plugin/ProcessManager.php
  34. +41 −0 src/Plugin/ProcessManagerInterface.php
  35. +37 −62 src/{Lifo/Daemon → }/Process.php
  36. +49 −48 src/{Lifo/Daemon → }/Promise.php
  37. +37 −32 src/{Lifo/Daemon → }/StringUtil.php
  38. +4 −6 src/{Lifo/Daemon → }/Task/AbstractTask.php
  39. +4 −12 src/{Lifo/Daemon → }/Task/TaskInterface.php
  40. +1 −1 src/{Lifo/Daemon → }/Worker/WorkerInterface.php
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ While this library does everything it can to allow you to create a rock solid da
user-land code to keep things stable.

### Requirements
- PHP 5.4.4+
- PHP ^7.4 || ^8.0 _(for PHP ^5.4 use the ^1.0 tag and branch)_
- A POSIX compatible operating system (Linux, OSX, BSD)
- PHP [POSIX](http://php.net/posix) and [PCNTL](http://php.net/pcntl) Extensions

@@ -78,5 +78,5 @@ purposes. I also didn't agree with some of his methodologies. I do require some
[Composer](http://getcomposer.org/) makes this a trivial issue.

---
_This library is in a fully working state. I've created very complex daemons that have run for weeks w/o any memory
leaks or crashes. But this is still a **Work in Progress**!_
_This library is in a fully working state. I've created very complex daemons that have run for months w/o any memory
leaks or crashes. More could be done...
17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -10,22 +10,21 @@
}
],
"autoload": {
"psr-0": {
"Lifo\\Daemon\\": "src/"
"psr-4": {
"Lifo\\Daemon\\": "src"
}
},
"require": {
"php": ">=5.4.4",
"php": ">=7.4",
"ext-pcntl": "*",
"symfony/event-dispatcher": "^2.8|^3.0",
"symfony/process": "^2.8|^3.0"
"ext-sysvmsg": "*",
"ext-sysvsem": "*",
"ext-sysvshm": "*",
"symfony/event-dispatcher": "^4.4||^5.0||^6.0",
"symfony/process": "^4.4||^5.0||^6.0"
},
"suggest": {
"symfony/var-dumper": "For better debug dump output",
"symfony/options-resolver": "For better plugin options support"
},
"require-dev": {
},
"scripts": {
}
}
4 changes: 2 additions & 2 deletions examples/src/Plugins/MemoryPlugin.php
Original file line number Diff line number Diff line change
@@ -14,15 +14,15 @@ class MemoryPlugin extends AbstractPlugin
{
use LogTrait;

protected function getDefaults()
protected function getDefaults(): array
{
return [
// how often to dump stats
'interval' => 3
];
}

public function setup($options = [])
public function setup(array $options = []): void
{
static $last = 0;
// not the proper place to put this, but it'll do for this example
5 changes: 3 additions & 2 deletions examples/src/SimpleTask/SimpleTask.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?php

use Lifo\Daemon\LogTrait;
use Lifo\Daemon\Task\AbstractTask;

class SimpleTask extends AbstractTask
{
// give us easy access to the daemon logging routines so we don't have to use Daemon::getInstance()->log
use \Lifo\Daemon\LogTrait;
use LogTrait;

public function run()
public function run(): void
{
$this->log("Task is running in the background! My PID=%d. I will now sleep for 2 seconds", getmypid());
sleep(2);
Loading