Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
guanguans committed Apr 14, 2022
1 parent 7ffcea3 commit a6d8ca0
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 36 deletions.
41 changes: 33 additions & 8 deletions README-EN.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# laravel-soar

![](docs/debug-bar.png)

# laravel-soar

> SQL optimizer and rewriter for laravel. - laravel 的 SQL 优化器和重写器。
[![Tests](https://github.com/guanguans/laravel-soar/workflows/Tests/badge.svg)](https://github.com/guanguans/laravel-soar/actions)
[![Check & fix styling](https://github.com/guanguans/laravel-soar/workflows/Check%20&%20fix%20styling/badge.svg)](https://github.com/guanguans/laravel-soar/actions)
[![codecov](https://codecov.io/gh/guanguans/laravel-soar/branch/main/graph/badge.svg?token=URGFAWS6S4)](https://codecov.io/gh/guanguans/laravel-soar)
[![codecov](https://codecov.io/gh/guanguans/laravel-soar/branch/master/graph/badge.svg?token=EWBG8GV4JD)](https://codecov.io/gh/guanguans/laravel-soar)
[![Latest Stable Version](https://poser.pugx.org/guanguans/laravel-soar/v)](//packagist.org/packages/guanguans/laravel-soar)
[![Total Downloads](https://poser.pugx.org/guanguans/laravel-soar/downloads)](//packagist.org/packages/guanguans/laravel-soar)
[![License](https://poser.pugx.org/guanguans/laravel-soar/license)](//packagist.org/packages/guanguans/laravel-soar)
Expand Down Expand Up @@ -59,16 +59,41 @@ $app->register(\Guanguans\LaravelSoar\SoarServiceProvider::class);

## Usage

### Automatically monitor output sql score
### Monitor output SQL score

![](docs/debug-bar.png)

### Example of use
### Interface method

```php
$soar = app('soar'); // get soar instance
User::query()->ddSoarJsonScore() // Convenience query method to output scoring report
\Soar::jsonScore(User::query()->toRawSql()); // soar facade generates scoring report
$soar = app('soar'); // 获取 Soar 实例

/**
* Soar 门面.
*
* @method static string score(string $sql) // SQL 评分
* @method static array arrayScore(string $sql) // SQL 数组格式评分
* @method static string jsonScore(string $sql) // SQL json 格式评分
* @method static string htmlScore(string $sql) // SQL html 格式评分
* @method static string mdScore(string $sql) // SQL markdown 格式评分
* @method static string explain(string $sql) // explain 解读信息
* @method static string mdExplain(string $sql) // markdown 格式 explain 解读信息
* @method static string htmlExplain(string $sql) // html 格式 explain 解读信息
* @method static null|string syntaxCheck(string $sql) // 语法检查
* @method static string fingerPrint(string $sql) // SQL 指纹
* @method static string pretty(string $sql) // 格式化 SQL
* @method static string md2html(string $sql) // markdown 转 html
* @method static string help() // Soar 帮助
* @method static null|string exec(string $command) // 执行任意 Soar 命令
* @method static string getSoarPath() // 获取 Soar 路径
* @method static array getOptions() // 获取 Soar 配置选项
* @method static \Guanguans\SoarPHP\Soar setSoarPath(string $soarPath) // 设置 Soar 路径
* @method static \Guanguans\SoarPHP\Soar setOption(string $key, $value) // 设置 Soar 配置选项
* @method static \Guanguans\SoarPHP\Soar setOptions(array $options) // 批量设置 Soar 配置选项
*
* @see \Guanguans\SoarPHP\Soar
*/
class Soar{}
```

## Testing
Expand Down
41 changes: 33 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# laravel-soar

![](docs/debug-bar.png)

# laravel-soar

> SQL optimizer and rewriter for laravel. - laravel 的 SQL 优化器和重写器。
[简体中文](README.md) | [ENGLISH](README-EN.md)

[![Tests](https://github.com/guanguans/laravel-soar/workflows/Tests/badge.svg)](https://github.com/guanguans/laravel-soar/actions)
[![Check & fix styling](https://github.com/guanguans/laravel-soar/workflows/Check%20&%20fix%20styling/badge.svg)](https://github.com/guanguans/laravel-soar/actions)
[![codecov](https://codecov.io/gh/guanguans/laravel-soar/branch/main/graph/badge.svg?token=URGFAWS6S4)](https://codecov.io/gh/guanguans/laravel-soar)
[![codecov](https://codecov.io/gh/guanguans/laravel-soar/branch/master/graph/badge.svg?token=EWBG8GV4JD)](https://codecov.io/gh/guanguans/laravel-soar)
[![Latest Stable Version](https://poser.pugx.org/guanguans/laravel-soar/v)](//packagist.org/packages/guanguans/laravel-soar)
[![Total Downloads](https://poser.pugx.org/guanguans/laravel-soar/downloads)](//packagist.org/packages/guanguans/laravel-soar)
[![License](https://poser.pugx.org/guanguans/laravel-soar/license)](//packagist.org/packages/guanguans/laravel-soar)
Expand Down Expand Up @@ -61,16 +61,41 @@ $app->register(\Guanguans\LaravelSoar\SoarServiceProvider::class);

## 使用

### 自动监控输出 sql 评分
### 监控输出 SQL 评分

![](docs/debug-bar.png)

### 使用示例
### 接口方法

```php
$soar = app('soar'); // 获取 soar 实例
User::query()->ddSoarJsonScore() // 便捷查询器方法输出评分报告
\Soar::jsonScore(User::query()->toRawSql()); // soar 门面生成评分报告
$soar = app('soar'); // 获取 Soar 实例

/**
* Soar 门面.
*
* @method static string score(string $sql) // SQL 评分
* @method static array arrayScore(string $sql) // SQL 数组格式评分
* @method static string jsonScore(string $sql) // SQL json 格式评分
* @method static string htmlScore(string $sql) // SQL html 格式评分
* @method static string mdScore(string $sql) // SQL markdown 格式评分
* @method static string explain(string $sql) // explain 解读信息
* @method static string mdExplain(string $sql) // markdown 格式 explain 解读信息
* @method static string htmlExplain(string $sql) // html 格式 explain 解读信息
* @method static null|string syntaxCheck(string $sql) // 语法检查
* @method static string fingerPrint(string $sql) // SQL 指纹
* @method static string pretty(string $sql) // 格式化 SQL
* @method static string md2html(string $sql) // markdown 转 html
* @method static string help() // Soar 帮助
* @method static null|string exec(string $command) // 执行任意 Soar 命令
* @method static string getSoarPath() // 获取 Soar 路径
* @method static array getOptions() // 获取 Soar 配置选项
* @method static \Guanguans\SoarPHP\Soar setSoarPath(string $soarPath) // 设置 Soar 路径
* @method static \Guanguans\SoarPHP\Soar setOption(string $key, $value) // 设置 Soar 配置选项
* @method static \Guanguans\SoarPHP\Soar setOptions(array $options) // 批量设置 Soar 配置选项
*
* @see \Guanguans\SoarPHP\Soar
*/
class Soar{}
```

## 测试
Expand Down
44 changes: 24 additions & 20 deletions src/Facades/Soar.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,34 @@

namespace Guanguans\LaravelSoar\Facades;

use Illuminate\Support\Facades\Facade;

/**
* @method static getSoarPath()
* @method static setSoarPath(string $soarPath)
* @method static getOptions()
* @method static setOption(string $key, $value)
* @method static setOptions(array $options)
* @method static score(string $sql)
* @method static jsonScore(string $sql)
* @method static arrayScore(string $sql)
* @method static htmlScore(string $sql)
* @method static mdScore(string $sql)
* @method static exec(string $command)
* @method static explain(string $sql)
* @method static mdExplain(string $sql)
* @method static htmlExplain(string $sql)
* @method static syntaxCheck(string $sql)
* @method static fingerPrint(string $sql)
* @method static pretty(string $sql)
* @method static md2html(string $sql)
* @method static help()
* Soar 门面.
*
* @method static string score(string $sql) // SQL 评分
* @method static array arrayScore(string $sql) // SQL 数组格式评分
* @method static string jsonScore(string $sql) // SQL json 格式评分
* @method static string htmlScore(string $sql) // SQL html 格式评分
* @method static string mdScore(string $sql) // SQL markdown 格式评分
* @method static string explain(string $sql) // explain 解读信息
* @method static string mdExplain(string $sql) // markdown 格式 explain 解读信息
* @method static string htmlExplain(string $sql) // html 格式 explain 解读信息
* @method static null|string syntaxCheck(string $sql) // 语法检查
* @method static string fingerPrint(string $sql) // SQL 指纹
* @method static string pretty(string $sql) // 格式化 SQL
* @method static string md2html(string $sql) // markdown 转 html
* @method static string help() // Soar 帮助
* @method static null|string exec(string $command) // 执行任意 Soar 命令
* @method static string getSoarPath() // 获取 Soar 路径
* @method static array getOptions() // 获取 Soar 配置选项
* @method static \Guanguans\SoarPHP\Soar setSoarPath(string $soarPath) // 设置 Soar 路径
* @method static \Guanguans\SoarPHP\Soar setOption(string $key, $value) // 设置 Soar 配置选项
* @method static \Guanguans\SoarPHP\Soar setOptions(array $options) // 批量设置 Soar 配置选项
*
* @see \Guanguans\SoarPHP\Soar
*/
class Soar extends \Illuminate\Support\Facades\Facade
class Soar extends Facade
{
public static function getFacadeAccessor()
{
Expand Down

0 comments on commit a6d8ca0

Please sign in to comment.