Download the PHP package suzhif/laravel-workerman without Composer

On this page you can find all versions of the php package suzhif/laravel-workerman. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-workerman

laravel-workerman

WorkerMan and Laravel integration SDK.

安装

配置

php artisan vendor:publish --provider="Suzhif\LaravelWorkerman\WorkermanServiceProvider"

config/workerman.php

<?php

return [
    'gateway' => [
        'socket_name' => 'tcp://0.0.0.0:8282',
        // gateway 进程的名称
        'name' => 'Gateway',
        // gateway 进程数
        'count' => 4,
        // 本机ip,分布式部署时使用内网ip
        'lanIp' => '127.0.0.1',
        // 内部通讯起始端口,假如$gateway->count=4,
        // 起始端口为4000 则一般会使用4000 4001 4002 4003 4个端口作为内部通讯端口
        'startPort' => 2000,
        // 服务注册地址
        'registerAddress' => '127.0.0.1:1238',
        // 心跳间隔 /s
        'pingInterval' => 10,
        // 心跳数据
        'pingData' => '{"type":"ping"}',
        // 客户端不回应心跳时,1:关闭连接
        'pingNotResponseLimit' => 1,
    ],

    'business_worker' => [
        // worker 名称
        'name' => 'BusinessWorker',
        // bussinessWorker 进程数量
        'count' => 4,
        // 服务注册地址
        'registerAddress' => '127.0.0.1:1238',
        // 事件处理类,默认是 Event 类
        'eventHandler' => \Suzhif\LaravelWorkerman\Event\Event::class,
    ]
];

启动

windows 系统下

项目根目录下新建文件 start_for_win.bat :

start /b php artisan workerman start --name=register
start /b php artisan workerman start --name=gateway
start /b php artisan workerman start --name=worker
pause

双击启动

>start /b php artisan workerman start --name=register

>start /b php artisan workerman start --name=gateway

>start /b php artisan workerman start --name=worker

>pause
请按任意键继续. . . ----------------------- WORKERMAN -----------------------------
Workerman version:4.0.27          PHP version:7.3.4
------------------------ WORKERS -------------------------------
worker                        listen                              processes status
Register                      text://0.0.0.0:1238                 1         [ok]
----------------------- WORKERMAN -----------------------------
Workerman version:4.0.27          PHP version:7.3.4
------------------------ WORKERS -------------------------------
worker                        listen                              processes status
Gateway                       tcp://0.0.0.0:8282                  4         [ok]
----------------------- WORKERMAN -----------------------------
Workerman version:4.0.27          PHP version:7.3.4
------------------------ WORKERS -------------------------------
worker                        listen                              processes status
BusinessWorker                none                                4         [ok]

WorkerMan 官网:windows操作系统下如何初始化多个Worker

Linux 系统下

以debug(调试)方式启动 (start|stop|restart|reload|status)

php artisan workerman start

以daemon(守护进程)方式启动

php artisan workerman start --d
$ php artisan workerman start --d
Workerman[workerman] start in DAEMON mode
------------------------------------------ WORKERMAN ------------------------------------------
Workerman version:4.0.27          PHP version:8.0.14
------------------------------------------- WORKERS -------------------------------------------
proto   user            worker            listen                 processes    status
tcp     admin_s         Register          text://0.0.0.0:1238    1             [OK]
tcp     admin_s         Gateway           tcp://0.0.0.0:8282     4             [OK]
tcp     admin_s         BusinessWorker    none                   4             [OK]
-----------------------------------------------------------------------------------------------
Input "php workerman stop --d" to stop. Start success.

测试

通过 telnet 连接配置的连接 tcp://0.0.0.0:8282

> telnet tcp://0.0.0.0:8282
Trying 127.0.0.1...
Connected to 127.0.01.
Escape character is '^]'.
Hello 7f00000107d200000001
7f00000107d200000001 login

License

MIT


All versions of laravel-workerman with dependencies

PHP Build Version
Package Version
Requires workerman/gateway-worker Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package suzhif/laravel-workerman contains the following files

Loading the files please wait ....