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

Installs

  • Total 100K
  • Win 62K
  • OS X 16K
  • Linux 22K
Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30
Windows 77 74 89 77 59 56 66 67 86 85 82 56 56 77 65 80 92 90 57 62 57 77 85 77 105 76 69 73 84 98 79 81 56 76 103 85 100 80 96 44 61 65 82 82 75 79
OS X 9 16 19 13 9 3 11 19 11 15 12 9 18 17 20 13 14 12 9 13 16 13 26 22 20 12 13 12 16 23 20 12 11 9 15 16 19 16 14 13 21 25 13 19 13 18
Linux 18 14 21 28 18 14 16 23 35 31 23 15 13 22 25 22 24 28 20 17 16 18 34 26 20 20 9 26 25 25 25 21 12 42 32 31 19 31 20 16 18 29 33 30 25 30

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.