sql-formatter:用于格式化sql语句的轻量级php类。 处理自动缩进和语法突出显示

时间:2021-04-05 16:22:32
【文件属性】:
文件名称:sql-formatter:用于格式化sql语句的轻量级php类。 处理自动缩进和语法突出显示
文件大小:43KB
文件格式:ZIP
更新时间:2021-04-05 16:22:32
HTML SqlFormatter 用于格式化sql语句的轻量级php类。 除了语法高亮显示之外,它还可以自动缩进并添加换行符。 历史 我发现自己不得不一直调试自动生成SQL语句,并希望找到一种方法来轻松输出格式化HTML,而不必包含巨大的库或将其复制并粘贴到在线格式化程序中。 我最初计划从PhpMyAdmin中提取格式代码,但是那是10,000多行代码并使用了全局变量。 我看到其他人也有同样的问题,并以Stack Overflow用户losif的回答为起点。 用法 SqlFormatter类具有一个采用SQL字符串的静态方法'format' 作为输入,并在pre标签内返回格式化HTML块。 用法示例: <?php require_once ( 'SqlFormatter.php' ); $ query = "SELECT count(*),`Column1`,`Testing`, `
【文件预览】:
sql-formatter-master
----LICENSE.txt(1KB)
----lib()
--------SqlFormatter.php(44KB)
----phpunit.xml.dist(529B)
----examples()
--------examples.php(6KB)
--------cli.php(676B)
----.travis.yml(93B)
----composer.lock(14KB)
----README.md(4KB)
----tests()
--------sql.sql(12KB)
--------SqlFormatterTest.php(6KB)
--------format.html(14KB)
--------format-highlight.html(70KB)
--------performance.php(1KB)
--------compress.html(11KB)
--------clihighlight.html(27KB)
--------highlight.html(67KB)
----.gitignore(8B)
----bin()
--------sql-formatter(1KB)
----composer.json(734B)

网友评论