guanguans / Think Soar
Licence: mit
SQL optimizer and rewriter extension package for thinkphp5/6 framework.
Stars: ✭ 71
Projects that are alternatives of or similar to Think Soar
Privesc
A collection of Windows, Linux and MySQL privilege escalation scripts and exploits.
Stars: ✭ 786 (+1007.04%)
Mutual labels: sql, mysql
Mysqldump Php
PHP version of mysqldump cli that comes with MySQL
Stars: ✭ 975 (+1273.24%)
Mutual labels: sql, mysql
Ezsql
PHP class to make interacting with a database ridiculusly easy
Stars: ✭ 804 (+1032.39%)
Mutual labels: sql, mysql
Smartsql
SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
Stars: ✭ 775 (+991.55%)
Mutual labels: sql, mysql
Aspnetcorenlog
ASP.NET Core NLog MS SQL Server PostgreSQL MySQL Elasticsearch
Stars: ✭ 54 (-23.94%)
Mutual labels: sql, mysql
Ddlparse
DDL parase and Convert to BigQuery JSON schema and DDL statements
Stars: ✭ 52 (-26.76%)
Mutual labels: sql, mysql
Usql
Universal command-line interface for SQL databases
Stars: ✭ 6,869 (+9574.65%)
Mutual labels: sql, mysql
Event Management
helps to register an users for on events conducted in college fests with simple logic with secured way
Stars: ✭ 65 (-8.45%)
Mutual labels: sql, mysql
Migrate
Database migrations. CLI and Golang library.
Stars: ✭ 7,712 (+10761.97%)
Mutual labels: sql, mysql
Mycat2
MySQL Proxy using Java NIO based on Sharding SQL,Calcite ,simple and fast
Stars: ✭ 750 (+956.34%)
Mutual labels: sql, mysql
Reiner
萊納 - A MySQL wrapper which might be better than the ORMs and written in Golang
Stars: ✭ 19 (-73.24%)
Mutual labels: sql, mysql
Nopcommerce
The most popular open-source eCommerce shopping cart solution based on ASP.NET Core
Stars: ✭ 6,827 (+9515.49%)
Mutual labels: sql, mysql
Countries States Cities Database
🌍 World countries, states, regions, provinces, cities, towns in JSON, SQL, XML, PLIST, YAML, and CSV. All Countries, States, Cities with ISO2, ISO3, Country Code, Phone Code, Capital, Native Language, Timezones, Latitude, Longitude, Region, Subregion, Flag Emoji, and Currency. #countries #states #cities
Stars: ✭ 1,130 (+1491.55%)
Mutual labels: sql, mysql
think-soar
SQL 语句优化器和重写器
适用于 thinkphp5 SQL 语句优化器扩展包,基于 guanguans/soar-php
环境要求
安装
$ composer require guanguans/think-soar --dev
使用
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
配置,更多详细配置请参考拷贝 config\soar.php
到 thinkphp
配置目录下,修改对应的配置,并设置 thinkphp
的 app_debug
、trace
配置为 true 。
SQL 评分
方法调用示例:
<?php
namespace app\index\controller;
use think\Db;
class Index
{
public function tests()
{
$user = Db::table('fa_user')->where('id', 1)->select();
$sql = Db::table('fa_user')->fetchSql()->select();
// 最后一条sql语句评分
echo soar_score();
// 指定sql语句评分
echo soar_score($sql);
echo soar()->score($sql);
}
}
输出结果:
explain 信息解读
方法调用示例:
<?php
namespace app\index\controller;
use think\Db;
class Index
{
public function tests()
{
$user = Db::table('fa_user')->where('id', 1)->select();
$sql = Db::table('fa_user')->fetchSql()->select();
// 最后一条sql语句explain信息解读
echo soar_html_explain();
echo soar_md_explain();
// 指定sql语句评分explain信息解读
echo soar_html_explain($sql);
echo soar_md_explain($sql);
echo soar()->htmlExplain($sql);
echo soar()->mdExplain($sql);
}
}
输出结果:
语法检查
方法调用示例:
$sql = 'selec * from fa_user';
echo soar_syntax_check();
echo soar_syntax_check($sql);
echo soar()->syntaxCheck($sql);
输出结果:
At SQL 1 : line 1 column 5 near "selec * from fa_user" (total length 20)
SQL 指纹
方法调用示例:
$sql = 'select * from fa_user where id=1';
echo soar_finger_print();
echo soar_finger_print($sql);
echo soar()->fingerPrint($sql);
输出结果:
select * from fa_user where id = ?
SQL 美化
方法调用示例:
$sql = 'select * from fa_user where id=1';
var_dump(soar_pretty());
var_dump(soar_pretty($sql));
var_dump(soar()->pretty($sql));
输出结果:
SELECT
*
FROM
fa_user
WHERE
id = 1;
markdown 转化为 html
方法调用示例:
echo soar_md2html("## 这是一个测试");
echo soar()->md2html("## 这是一个测试");
输出结果:
...
<h2>这是一个测试</h2>
...
soar 帮助
方法调用示例:
var_dump(soar_help());
var_dump(soar()->help());
输出结果:
···
'Usage of /Users/yaozm/Documents/wwwroot/soar-php/soar:
-allow-charsets string
AllowCharsets (default "utf8,utf8mb4")
-allow-collates string
AllowCollates
-allow-drop-index
AllowDropIndex, 允许输出删除重复索引的建议
-allow-engines string
AllowEngines (default "innodb")
-allow-online-as-test
AllowOnlineAsTest, 允许线上环境也可以当作测试环境
-blacklist string
指定 blacklist 配置文件的位置,文件中的 SQL 不会被评审。
···
执行任意 soar 命令
方法调用示例:
$command = "echo '## 这是另一个测试' | /Users/yaozm/Documents/wwwroot/soar-php/soar.darwin-amd64 -report-type md2html";
echo soar_exec($command);
echo soar()->exec($command);
输出结果:
...
<h2>这是另一个测试</h2>
...
License
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].