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
  • 4 years ago
  • 40 minutes ago
  • 6 years ago

Installs

  • Total 123K
  • Win 77K
  • OS X 19K
  • Linux 26K
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 Sep 3 Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28 Aug 27 Aug 26 Aug 25 Aug 24 Aug 23 Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7
Windows 76 62 58 74 78 44 46 50 62 69 74 63 57 44 59 68 58 72 56 35 50 55 68 56 71 57 41 43 52 64 62 61 66 39 55 56 69 61 67 62 49 42 67 56 74 63
OS X 5 16 11 13 16 4 12 11 10 13 10 14 6 5 12 13 11 10 9 7 7 15 9 8 12 11 12 9 10 14 15 14 14 6 7 8 10 12 8 6 2 9 10 7 13 11
Linux 16 15 19 25 18 13 15 19 17 24 20 18 13 14 14 18 25 26 20 17 24 23 24 26 19 19 11 6 26 14 16 23 23 10 13 16 22 16 18 18 11 17 10 15 21 21

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.