Giter VIP home page Giter VIP logo

library's 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.

library's People

Contributors

twose avatar deminy avatar sy-records avatar matyhtf avatar leocavalcante avatar huanghantao avatar yunbaoi avatar djw1028769140 avatar doubaokun avatar jcheron avatar nhzex avatar appla avatar filakhtov avatar yurunsoft avatar shiguangqi avatar sinute avatar yespire 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.