ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

PHPIntel

by jotson ST2/ST3

Auto-complete for PHP functions and objects

Details

  • 3 1.0.5
    1.0.2
  • github.​com
  • github.​com
  • 3 years ago
  • 48 minutes ago
  • 5 years ago

Installs

  • Total 94K
  • Win 58K
  • OS X 16K
  • Linux 21K
Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4
Windows 77 77 80 76 40 54 70 66 63 97 86 67 58 83 94 78 86 82 63 63 69 80 103 103 81 54 78 120 95 97 98 104 63 70 102 138 116 90 39 44 43 86 76 78 69 67
OS X 29 17 17 7 10 11 19 27 16 17 25 15 10 9 9 16 11 18 12 10 17 20 20 25 20 12 16 19 26 19 19 26 15 14 32 44 36 28 11 9 5 13 13 16 19 9
Linux 32 24 36 24 18 29 31 25 20 21 24 21 24 29 15 28 29 23 16 21 27 29 22 32 24 17 14 22 30 24 30 42 17 22 36 53 27 19 15 15 14 23 25 22 15 22

Readme

Source
raw.​githubusercontent.​com

SublimePHPIntel

PHP code scanner and analyzer for code intelligence within PHP projects.

Sublime Text 3: Checkout branch st3 for Sublime Text 3 compatible version

Setup

  1. Install using Package Control
  2. Create or open a project with PHP files
  3. Run the PHPIntel: Scan Project command from the command palette

After the initial scan, PHP files will be automatically re-scanned whenever you save them.

Go to declaration

To open a class declaration, place your cursor on the class name and press Ctrl+f5 or Cmd+f5

Magic and factory methods

You can teach SublimePHPIntel about magic and factory methods using regular expression matching. Some expressions for Magento and the Yii framework are already included. Please send pull requests with additional expressions for other frameworks that you'd like to see included out of the box.

For example, your code might have a factory method that returns a model:

App::getModel('modelname')->doSomething();

To get code completion for this, define a template for the factory in the configuration settings (Preferences | Package Settings | SublimePHPIntel | Settings - User).

Factory patterns are defined like so:

{
    "customfactories":
        [
            { "pattern": "<Regular expression>", "class": "<Class name>", option, ..., option },
            { "pattern": "<Regular expression>", "class": "<Class name>", option, ..., option },
            ...
            { "pattern": "<Regular expression>", "class": "<Class name>", option, ..., option }
        ]
}
  • Patterns are just regular expressions.
  • Class names are strings with optional numbered expressions that match capturing groups in the regular expressions.
  • You need to double escape backslashes to preserve them.

For example, this: “json { "pattern”: “getModel\('(.*?)'\)”, “class”: “Model_%1”, “capitalize”: true }

...will cause this:
```php
getModel('abc')

…to be interpreted as: “php Model_Abc

**Options**

capitalize: *true|false* — *Uppercase the first letter of the captured expression*

## Known issues

I'm working on these issues:

- Variable assignment is not detected (for example: <code>$var = CODE</code> where CODE returns an object.
- Files are not removed from the index when they are deleted. For now, you'll need to rescan to remove them.
- Files added to the project from outside of the editor are not added to the index. For now, you'll either need to open the file and save it or rescan the project.
- I'm not completely happy with the way it deals with cases where the same class is declared more than once. Need to do some research to see how others deal with that.