• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

swoole/library:

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

swoole/library

开源软件地址(OpenSource Url):

https://github.com/swoole/library

开源编程语言(OpenSource Language):

PHP 99.8%

开源软件介绍(OpenSource Introduction):

Swoole Library

Twitter Discord Library Status License

Table of Contents

How to Contribute

Just open new pull requests (and we need unit tests for new features)

Code Requirements

Development

Branches

  • 4.6.x: For Swoole 4.6, which supports PHP 7.2+
  • 4.5.x: For Swoole 4.5, which supports PHP 7.1+

Dockerized Local Development (Compose v2)

First, you need to build the base image:

docker compose build image

Then run the following command to autoload PHP classes/files (no extra Composer packages to be installed):

docker compose run --rm composer install

Secondly, run the next command to start Docker containers:

docker compose up

Alternatively, if you need to rebuild the service(s) and to restart the containers:

docker compose build image --no-cache
docker compose up --force-recreate

Now you can create an app's bash session:

docker compose exec app bash

And run commands inside the container:

composer test

Or you can tell to run it directly:

docker compose exec app composer test

Examples

Once you have Docker containers started (as discussed in previous section), you can use commands like following to run examples under folder examples.

Examples of Database Connection Pool

docker compose exec app php examples/mysqli/base.php
docker compose exec app php examples/pdo/base.php
docker compose exec app php examples/redis/base.php

Examples of FastCGI Calls

There is a fantastic example showing how to use Swoole as a proxy to serve a WordPress website using PHP-FPM. Just open URL http://127.0.0.1 in the browser and check what you see there. Source code of the example can be found here.

Here are some more examples to make FastCGI calls to PHP-FPM:

docker compose exec app php examples/fastcgi/greeter/call.php
docker compose exec app php examples/fastcgi/greeter/client.php
docker compose exec app php examples/fastcgi/proxy/base.php
docker compose exec app php examples/fastcgi/var/client.php

Compatibility Patch (Swoole version <= v4.4.12)

define('SWOOLE_USE_SHORTNAME', true); // or false (it depends on you)

Coding Style Checks and Fixes

To update Composer packages (optional):

docker compose run --rm composer update

To check coding standard violations:

docker compose run --rm composer cs-check

To correct coding standard violations automatically:

docker compose run --rm composer cs-fix

Third Party Libraries

Here are all the third party libraries used in this project:

You can find the licensing information of these third party libraries here.

License

This project follows the Apache 2 license.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap