An smart macro PHP plugin for Sublime Text.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
macros Fixes and refactorings Dec 31, 2017
tests Fix test suite Jan 22, 2018
.coveragerc Refactor tests Dec 9, 2017
.flake8 Refactor tests Dec 9, 2017
.gitattributes Rename plugin php-grammar -> PHPGrammar Jan 1, 2018
.travis.yml Try fix Travis Jul 1, 2018
CONTRIBUTING.md Refactor tests Dec 9, 2017
Completion Rules.tmPreferences Completion rules: Minimise auto-complete noise Feb 9, 2015
Default.sublime-keymap Enhance Tab insert => inside arrays Jun 17, 2018
LICENSE Rename plugin php-grammar -> PHPGrammar Jan 1, 2018
Main.sublime-menu Rename plugin php-grammar -> PHPGrammar Jan 1, 2018
README.md Fix manual install docs Jan 22, 2018
Symbol List - Class Magic Methods.tmPreferences Rename plugin php-grammar -> PHPGrammar Jan 1, 2018
Symbol List - Class Methods.tmPreferences Rename plugin php-grammar -> PHPGrammar Jan 1, 2018
Symbol List - Classes.tmPreferences Rename plugin php-grammar -> PHPGrammar Jan 1, 2018
Symbol List - Functions.tmPreferences Rename plugin php-grammar -> PHPGrammar Jan 1, 2018
Symbol List - Interfaces.tmPreferences Rename plugin php-grammar -> PHPGrammar Jan 1, 2018
Symbol List - Namespaces Use Aliases.tmPreferences Use default package syntax Dec 9, 2017
Symbol List - Namespaces.tmPreferences Rename plugin php-grammar -> PHPGrammar Jan 1, 2018
Symbol List - Traits.tmPreferences Rename plugin php-grammar -> PHPGrammar Jan 1, 2018
appveyor.yml Rename plugin php-grammar -> PHPGrammar Jan 1, 2018
plugin.py Rename plugin php-grammar -> PHPGrammar Jan 1, 2018
unittesting.json Refactor tests Dec 9, 2017

README.md

WHAT PHPGRAMMAR IS

An improved PHP syntax, good indentation rules, smart macros, and more.

Build Status Build status Coverage Status Minimum Sublime Version Latest Stable Version GitHub stars Downloads Author

Completions and snippets are provided separately by PHP Completions Kit and PHP Snippets.

PHPGrammar has been renamed in v.2.0.0 (previously known as php-grammar)

INSTALLATION

Package Control installation

The preferred method of installation is Package Control.

Manual installation

Close Sublime Text, then download or clone this repository to a directory named PHPGrammar in the Sublime Text Packages directory for your platform:

  • 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

USAGE

Smart macros

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.

On Ctrl+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()
}                           //        {
                            //            |
                            //        }
                            //    }

On Ctrl+;

'str|ing'                   //    'string';|
<?php

function_call(|)            //    function_call();|

On Enter

array(|)                    //    array(
                            //        |
                            //    )
<?php

function_call(|)            //    function_call(
                            //        |
                            //    )
<?php

new class_name(|)           //    new class_name(
                            //        |
                            //    )

On Tab

$arr = array(               //    $arr = array(
    'str|'                  //        'str' => |
)                           //    )
<?php

$arr = array(               //    $arr = array(
    'str'|                  //        'str' => |
)                           //    )

On [

$arr = |                    //    $arr = [|];

On ]

$arr = [|                   //    $arr = [|];

CONTRIBUTING

See CONTRIBUTING.md.

LICENSE

Released under the BSD 3-Clause License.