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

PHPIntel

by jotson ALL Trending

Auto-complete for PHP functions and objects

Details

  • 1.0.5
    1.0.2
  • github.​com
  • github.​com
  • 9 years ago
  • 44 minutes ago
  • 12 years ago

Installs

  • Total 189K
  • Win 123K
  • Mac 27K
  • Linux 39K
Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2
Windows 2 12 2 10 2 10 9 3 3 6 5 8 13 14 8 7 5 10 2 3 6 14 9 6 11 7 10 6 10 10 8 6 8 9 11 11 10 5 4 4 7 5 11 8 5 5
Mac 0 3 1 4 2 1 2 2 0 0 1 3 2 2 2 1 0 0 1 1 1 0 1 0 2 0 4 2 2 0 0 0 0 5 0 2 1 2 1 2 0 2 1 0 2 1
Linux 0 3 2 1 1 1 2 1 1 0 1 2 1 3 1 2 2 1 0 2 5 2 5 5 3 2 0 7 1 1 1 2 2 2 3 1 1 1 0 4 2 1 0 5 4 1

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.