Download the PHP package henry-wiki/sc-indent-fix without Composer
On this page you can find all versions of the php package henry-wiki/sc-indent-fix. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download henry-wiki/sc-indent-fix
More information about henry-wiki/sc-indent-fix
Files in henry-wiki/sc-indent-fix
Package sc-indent-fix
Short Description PHP+HTML mixed indentation fixer
License MIT
Informations about the package sc-indent-fix
sc-indent-fix
PHP+HTML mixed indentation fixer.
PHP + HTML 混合縮排修復工具。
Also re-indents multi-line string blocks ($var = "...") — HTML content by tag nesting depth, SQL content in dbt/GitLab style.
亦會重新排版多行字串區塊($var = "...")——HTML 內容依標籤嵌套深度、SQL 內容依 dbt/GitLab 風格。
Requirements / 系統需求
- PHP 7.3+
Installation / 安裝方式
Quick Start / 快速開始
Architecture / 架構說明
The fixer works in two layers: 修復器分為兩層處理:
- php-cs-fixer — Applies PSR-2 formatting in-memory / 在記憶體中套用 PSR-2 格式化
- sc_indent_fix_phphtml — Secondary pass for PHP+HTML mixed indentation / 二次處理,修正 PHP + HTML 混合縮排
Examples / 範例
1. Basic function / 基本函式
2. if/else + HTML tag nesting / if/else + HTML 標籤嵌套
3. Nested HTML tags / 巢狀 HTML 標籤
4. foreach inside HTML / HTML 內嘅 foreach
5. Switch/case
6. Multi-line HTML string block / 多行 HTML 字串區塊
7. Multi-line SQL string block / 多行 SQL 字串區塊
Known Limitations / 已知限制
The formatter does not parse or modify the following syntaxes. They are simply passed through unchanged — the original code is never altered or removed: 以下語法嘅縮排唔會被修正,但原碼完全唔會受影響、唔會被刪除或改變:
- Alternative syntax (
endif;,endforeach;,endwhile;,endfor;) / 替代語法 - Raw
?>/<?phpHTML blocks (non-string embedded HTML) / 原始 HTML 區塊 - PHP 8+ syntax (
match,enum, attributes, arrow function) / PHP 8+ 語法 - Complex heredoc/nowdoc / 複雜 heredoc/nowdoc
- Multi-line JSON / JavaScript / CSS strings (kept at the base indentation, not deeply re-indented) / 多行 JSON/JavaScript/CSS 字串(僅保留基礎縮排,唔會深度排版)
These limitations will not be addressed in the near future. 以上限制短期內唔會處理。
License / 授權條款
MIT