当前位置:网站首页>Using the collaboration database query of Poole in laravel5.6

Using the collaboration database query of Poole in laravel5.6

2022-06-24 11:09:00 PHP Development Engineer

What is? Swoole

Direct application Swoole Introduction to the official website :PHP The asynchronous 、 parallel 、 High performance network communication engine , Use pure C Language writing , Provides PHP Asynchronous multithreaded server of language , asynchronous TCP/UDP Network client , asynchronous MySQL, asynchronous Redis, Database connection pool ,AsyncTask, Message queue , Millisecond timer , Asynchronous file read and write , asynchronous DNS Inquire about . Swoole Built in Http/WebSocket Server side / client 、Http2.0 Server side .

Swoole The documents on the official website are not rich enough , It's a headache , But most of the questions explain . If you are right about Swoole Very interested , So look at this Swoole Introductory tutorial .Swoole Provides multithreading 、 Long connection and many other awesome functions , hold php Up to a new level , You can take a look at the introductory tutorial , This article is limited to Laravel and Swoole The combination of .

Swoole In order to provide services , Must be CLI mode , What is? CLI How about the model ? If you Swoole The business code is written in a file called server.php In the file of , Then enter... At the command line php server.php Turn on . This is a headache , because Laravel This is not how the framework works , How can we Laravel Union ? you 're right , Customize one Artisan Command, It's that simple .

Highly recommended in your laravel In the project , Use laravel-s This package .

composer require "hhxsv5/laravel-s:~1.0" -vvv

then , rely on kuaiapp/db This package , The function is to achieve Swoole\Coroutine\MySQL False of PDO Interface

composer require "kuaiapp/db" -vvv

to vendor/laravel/framework hit patch

cd .//vendor/laravel/framework
wget https://gist.githubusercontent.com/xiaohuilam/81ae50c1bc06180bd8e6fcbdaadba86a/raw/529cb96ca9abeed7a35076725b3b5cd8a1e04ff7/git.patch
git am < git.patch

start-up laravel-s

php artisan laravels start

Now you can test your database queries .

The above is the whole content of this paper , I hope it will be helpful for your study , I also hope you can support open source .

Complete example :http://github.crmeb.net/u/defu

come from “ Open source world ” , link :https://ym.baisou.ltd/post/680.html, If you want to reprint , Please indicate the source , Otherwise, the legal liability will be investigated .

原网站

版权声明
本文为[PHP Development Engineer ]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/06/20210604184024446T.html

随机推荐