An improved PHP syntax, good indentation rules, smart macros, and more.
Completions and snippets are provided separately by PHP Completions Kit and PHP Snippets.
The preferred method of installation is Package Control.
Close Sublime Text, then download or clone this repository to a directory named PHPGrammar in the Sublime Text Packages directory for your platform:
OS | Command |
---|---|
Linux | git clone https://github.com/gerardroche/sublime-php-grammar.git ~/.config/sublime-text-3/Packages/PHPGrammar |
OSX | git clone https://github.com/gerardroche/sublime-php-grammar.git ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/PHPGrammar |
Windows | git clone https://github.com/gerardroche/sublime-php-grammar.git %APPDATA%\Sublime/ Text/ 3/Packages/PHPGrammar |
To insert any literal character add Shift
e.g. in a case where Enter
runs a macro, to insert a newline on Enter
(instead of running the macro) press Shift+Enter
.
<?php
array( // array(
'str|' // 'str',
) // |
// )
<?php
'str|ing' // 'string';
// |
<?php
function_call(|) // function_call();
// |
<?php
if ($condition|) // if ($condition) {
// |
// }
<?php
foreach ($x => $y|) // foreach ($x => $y) {
// |
// }
<?php
while ($condition|) // while ($condition) {
// |
// }
<?php
for ($i = 0; $i < ; $i++|) // for ($i = 0; $i < ; $i++) {
// |
// }
<?php
switch ($condition|) // switch ($condition) {
// |
// }
<?php
function x(|) // function x()
// {
// |
// }
<?php
class x // class x
{ // {
public function y(|) // public function y()
} // {
// |
// }
// }
'str|ing' // 'string';|
<?php
function_call(|) // function_call();|
array(|) // array(
// |
// )
<?php
function_call(|) // function_call(
// |
// )
<?php
new class_name(|) // new class_name(
// |
// )
$arr = array( // $arr = array(
'str|' // 'str' => |
) // )
<?php
$arr = array( // $arr = array(
'str'| // 'str' => |
) // )
$arr = | // $arr = [|];
$arr = [| // $arr = [|];
See CONTRIBUTING.md.
Released under the BSD 3-Clause License.