PHPackages                             guanguans/think-soar - 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. [Database &amp; ORM](/categories/database)
4. /
5. guanguans/think-soar

AbandonedLibrary[Database &amp; ORM](/categories/database)

guanguans/think-soar
====================

SQL optimizer and rewriter extension package for thinkphp5 framework.

v1.1.2(5y ago)7553816MITPHP

Since Jul 6Pushed 3y ago2 watchersCompare

[ Source](https://github.com/guanguans/think-soar)[ Packagist](https://packagist.org/packages/guanguans/think-soar)[ Fund](https://www.guanguans.cn/images/wechat.jpeg)[ Patreon](https://www.patreon.com/guanguans)[ RSS](/packages/guanguans-think-soar/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (3)Versions (8)Used By (0)

think-soar
==========

[](#think-soar)

> ！本项目不再维护，如果有人愿意接手维护可以联系我。

SQL 语句优化器和重写器

[![](docs/usage.gif)](docs/usage.gif)

> 适用于 thinkphp5 SQL 语句优化器扩展包，基于 **[guanguans/soar-php](https://github.com/guanguans/soar-php)**

[![Build Status](https://camo.githubusercontent.com/9891e974b80b0b411ad25b0f2fee94dadb4667d0d401d16cc9d3b6f8a50c5c5b/68747470733a2f2f7472617669732d63692e6f72672f6775616e6775616e732f7468696e6b2d736f61722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/guanguans/think-soar)[![Build Status](https://camo.githubusercontent.com/10957992c0afd393b683e4e4a44e77b57d39ff76a2ee161f28e63ea6f4f009ea/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6775616e6775616e732f7468696e6b2d736f61722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/guanguans/think-soar/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/923f511880f459efe17aefa4349067e36389b9487308ed4d49de213c198fd0a0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6775616e6775616e732f7468696e6b2d736f61722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/guanguans/think-soar/?branch=master)[![StyleCI](https://camo.githubusercontent.com/d065dd5805cfe8d5c45155175be85ffe94e6804e4c5c9c28cb819012d5f12c84/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3139353532313133392f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/195521139)[![Latest Stable Version](https://camo.githubusercontent.com/7e93446bba5bd47f41dc47fba84d3c23e62e688b3b0705b26db615a1cdfb16a3/68747470733a2f2f706f7365722e707567782e6f72672f6775616e6775616e732f7468696e6b2d736f61722f762f737461626c65)](https://packagist.org/packages/guanguans/think-soar)[![Total Downloads](https://camo.githubusercontent.com/d39fef2580ac53c727b6f383678b986caa3a4e5d526e2ee0d256f589cc07c3cf/68747470733a2f2f706f7365722e707567782e6f72672f6775616e6775616e732f7468696e6b2d736f61722f646f776e6c6f616473)](https://packagist.org/packages/guanguans/think-soar)[![License](https://camo.githubusercontent.com/80a1e9a2af66aafd69a49ddb73825a91bfa0bba081da1bc69cd3e137b43f7666/68747470733a2f2f706f7365722e707567782e6f72672f6775616e6775616e732f7468696e6b2d736f61722f6c6963656e7365)](https://packagist.org/packages/guanguans/think-soar)

环境要求
----

[](#环境要求)

- [topthink/framework &gt;= 5.1](https://github.com/top-think/framework)

安装
--

[](#安装)

```
$ composer require guanguans/think-soar --dev
```

使用
--

[](#使用)

### 下载 [XiaoMi](https://github.com/XiaoMi/) 开源的 SQL 优化器 [soar](https://github.com/XiaoMi/soar/releases)，更多详细安装请参考 [soar install](https://github.com/XiaoMi/soar/blob/master/doc/install.md)

[](#下载-xiaomi-开源的-sql-优化器-soar更多详细安装请参考-soar-install)

```
# macOS
$ wget https://github.com/XiaoMi/soar/releases/download/0.11.0/soar.darwin-amd64
# linux
$ wget https://github.com/XiaoMi/soar/releases/download/0.11.0/soar.linux-amd64
# windows
$ wget https://github.com/XiaoMi/soar/releases/download/0.11.0/soar.windows-amd64
# 用其他命令或下载器下载均可以
```

### 配置，更多详细配置请参考 [soar config](https://github.com/XiaoMi/soar/blob/master/doc/config.md)

[](#配置更多详细配置请参考-soar-config)

拷贝 `config\soar.php` 到 `thinkphp` 配置目录下，修改对应的配置，并设置 `thinkphp` 的 `app_debug`、`trace` 配置为 true 。

### SQL 评分

[](#sql-评分)

**方法调用示例：**

```
