Code Monkey home page Code Monkey logo

phpforker's Introduction

PHPForker

What is it

A simple Multi-Process programming skeleton written in PHP and learned much from Workerman, which remove the part of Network Event Library, it aims at two aspects by programming personally:

  • Help us study PHP Multi-Process programming
  • Help us find out how Workerman core works

PHPForker是什么

PHPForker是一个PHP多进程编程骨架,借鉴了Workerman诸多优良编程**,剥离了其中的网络事件库抽象部分,集中围绕多进程编程,为了便于直观的调试以及保持最轻的多进程骨架,所以简单的内嵌了一个基于select多路复用技术的 TCP & UDP Server。为了学习如此优秀的Workerman框架,金牛座亲自撸了一遍,本项目旨在深入学习和分享:

  • 学习PHP多进程编程**
  • 学习Workerman内核工作原理

Prerequisites

  • >= PHP 5.3
  • A POSIX compatible operating system (Linux, OSX, BSD)
  • POSIX extensions for PHP
  • PCNTL extensions for PHP

Usage

<?php
require_once dirname(__DIR__). '/Autoloader.php';

use PHPForker\Container;

//imitate...
$totalContainer = 2;
for($i = 1; $i <= $totalContainer; $i++)
{
    $name = "demo-" . $i;
    $socket_name = "tcp://0.0.0.0:2" . str_pad($i, 3, '0', STR_PAD_LEFT);
    $box = new Container($socket_name);
    $box->setPublicProps([
        'name' => $name,
        'count' => 2,
        'user' => 'root',
    ]);
}

Demostrate

demo1

demo2

demo3

demo4

demo5

Related links and thanks

phpforker's People

Contributors

blogdaren avatar

Watchers

James Cloos avatar dtarker avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.