Git Product home page Git Product logo

php-ext's Introduction

php-ext

This is a php extensions, I will continue update and share it for everyone. Currently it only support PHP 7.4 or greater than 7.4.

VThread

VThread is extension support for you run code PHP in environment C (native code). It's best if your function need resolve a lots of logic and take a long time for finish. That time is you need use VThread to optimize process.

How to install?

First step you need download file .so on folder ./vthread after that add this line into your php.ini file: extension="/path/to/file.so"

How to check working?

Create a new file and use phpinfo to check

alt text

Code for test [nukethread]

alt text

This function same with Fibers, I mean callback will execute in child thread but it's keep asyn. So why we need use it? When you implement if appear errors then main process keep continue and only stop on child process. And it'll support execute your function callback on native code.

On PHP:

        <?php

        try {
            
            nukethread(function () {
                printf("Done ");
                sleep(1);
            });
        }catch(\Exception $e) {
            print_r($e->getMessage());
        }

        ?>

Code for test [nukethreadOnlyThread]

It'll support execute your function callback on native code and only one thread.

On PHP:

        <?php

        try {
            
            echo nukethreadOnlyThread(function () {
                return rand(1,999999999999999999);
            });
        }catch(\Exception $e) {
            print_r($e->getMessage());
        }

        ?>

Issue

If you need anything, please create new issue https://github.com/steveleetn91/php-ext/issues.

One more thing if you enjoy and wanna I continue made extensions support for PHP, so let's me star for this repository.

php-ext's People

Contributors

steveleetn91 avatar

Stargazers

 avatar

Watchers

 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.