PHPackages                             extraswoft/tideways - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. extraswoft/tideways

ActiveLibrary

extraswoft/tideways
===================

tideways for swoft

v0.0.1.0(7y ago)22.4k1Apache-2.0PHP

Since May 29Pushed 7y ago1 watchersCompare

[ Source](https://github.com/masixun71/swoft-tideways)[ Packagist](https://packagist.org/packages/extraswoft/tideways)[ RSS](/packages/extraswoft-tideways/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (11)Used By (0)

[![](https://camo.githubusercontent.com/eea5374085bbc8f3c2603a9bfec7de47f65d1133ff71ba25cd7800fd366fc6a6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d76302e302e302e392d7265642e737667)](https://camo.githubusercontent.com/eea5374085bbc8f3c2603a9bfec7de47f65d1133ff71ba25cd7800fd366fc6a6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d76302e302e302e392d7265642e737667)[![](https://camo.githubusercontent.com/40132ea396da1fc0c9f978249f670b77aef6e66ffb0f44987e0e2ba3113a175d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d372e312d6f72616e67652e737667)](https://camo.githubusercontent.com/40132ea396da1fc0c9f978249f670b77aef6e66ffb0f44987e0e2ba3113a175d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d372e312d6f72616e67652e737667)[![](https://camo.githubusercontent.com/6111524cc44700e3d9915944f83dcb7e7b4ee92d35ff93b17a8c5a0957d3120a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73776f6f6c652d2533453d342e302d626c75652e737667)](https://camo.githubusercontent.com/6111524cc44700e3d9915944f83dcb7e7b4ee92d35ff93b17a8c5a0957d3120a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73776f6f6c652d2533453d342e302d626c75652e737667)[![](https://camo.githubusercontent.com/f5741e6fb1b9d8446c03402bc4d0e0a713f5d7ca81cf9f0ea57d476a1403acf7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d7573742d6d6f6e676f64622e736f2d79656c6c6f772e737667)](https://camo.githubusercontent.com/f5741e6fb1b9d8446c03402bc4d0e0a713f5d7ca81cf9f0ea57d476a1403acf7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d7573742d6d6f6e676f64622e736f2d79656c6c6f772e737667)[![](https://camo.githubusercontent.com/9ffd041589a5622ba2951297ee5b844217f950f4d4f51ff469baed7f77ac4bbc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d7573742d74696465776179732e736f2d79656c6c6f772e737667)](https://camo.githubusercontent.com/9ffd041589a5622ba2951297ee5b844217f950f4d4f51ff469baed7f77ac4bbc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d7573742d74696465776179732e736f2d79656c6c6f772e737667)

简介
==

[](#简介)

本项目基于github上的swoft开源项目进行组件开发，扩展了一个swoft-tideways组件, tideways 是一个PHP性能被动分析工具，对php7支持良好，并且是非侵入式的监控 提供了火焰图，调用图和调用的完善记录

环境强制要求
======

[](#环境强制要求)

1. 必须PHP 7.1 +
2. swoole版本必须大于等于4.0,并且按照swoft官方要求的要求安装
3. mongodb.so
4. tideaways.so, [安装方法可点击这里，官方文档非常详细](https://tideways.io/profiler/docs/setup/installation)

使用步骤
====

[](#使用步骤)

1.php.ini文件配置
-------------

[](#1phpini文件配置)

```
   [mongodb]
   extension=mongodb.so
   [tideways]
   extension=tideways.so
   ;不需要自动加载，在程序中控制就行
   tideways.auto_prepend_library=0
   ;频率设置为100，在程序调用时能改
   tideways.sample_rate=100
```

2.安装中文版的xhgui
-------------

[](#2安装中文版的xhgui)

```
   git clone https://github.com/laynefyc/xhgui-branch.git
   cd xhgui-branch
   php install.php
```

3.mongodb服务端增加索引 (xhprof是我们使用的库名,可根据需要变更)
-----------------------------------------

[](#3mongodb服务端增加索引-xhprof是我们使用的库名可根据需要变更)

```
    $ mongo
    > use xhprof
    > db.results.ensureIndex( { 'meta.SERVER.REQUEST_TIME' : -1 } )
    > db.results.ensureIndex( { 'profile.main().wt' : -1 } )
    > db.results.ensureIndex( { 'profile.main().mu' : -1 } )
    > db.results.ensureIndex( { 'profile.main().cpu' : -1 } )
    > db.results.ensureIndex( { 'meta.url' : 1 } )
```

4.增加一个xhgui的nginx配置文件,root 指向我们刚刚安装的xhgui-branch下面的webroot目录
------------------------------------------------------------

[](#4增加一个xhgui的nginx配置文件root-指向我们刚刚安装的xhgui-branch下面的webroot目录)

##### 注：xhgui支持php56,php7-fpm,需要启动一个fpm

[](#注xhgui支持php56php7-fpm需要启动一个fpm)

##### 注：若是在本地配置，记得配置hosts文件

[](#注若是在本地配置记得配置hosts文件)

##### 注：若报错cache目录不可写，请给cache目录权限修改为777

[](#注若报错cache目录不可写请给cache目录权限修改为777)

```
    server {
        listen       80;
        server_name  local-xhgui.xxxx.com;
        root  /apps/webroot/production/xhgui-branch/webroot;

        location / {
            index  index.php;
            if (!-e $request_filename) {
                rewrite . /index.php last;
            }
        }

        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9001;
            fastcgi_index  index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }
```

5.给你的swoft项目引入组件
----------------

[](#5给你的swoft项目引入组件)

```
    composer require extraswoft/tideways
```

6.在config/beans 下面添加一个tideways.php文件
------------------------------------

[](#6在configbeans-下面添加一个tidewaysphp文件)

```
