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

Installs

  • Total 115K
  • Win 72K
  • OS X 18K
  • Linux 25K
Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6 Jun 5 Jun 4 Jun 3 Jun 2 Jun 1 May 31 May 30 May 29 May 28 May 27 May 26 May 25 May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4
Windows 30 31 35 63 58 58 74 59 49 40 67 29 71 70 57 47 41 79 61 70 69 53 46 42 55 60 69 99 71 42 58 53 79 76 82 80 49 47 73 59 74 73 68 46 65 80
OS X 5 3 8 4 8 12 10 7 2 9 8 7 13 15 15 8 8 10 11 15 16 12 7 2 13 13 18 15 7 6 5 14 16 19 14 11 6 8 13 15 13 22 12 6 5 17
Linux 10 16 10 15 17 18 26 15 20 14 20 15 18 21 20 17 10 21 28 19 20 19 9 16 22 17 21 18 12 12 24 28 17 23 24 27 16 11 23 26 26 32 18 14 10 16

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.