Is it possible to obtain a package which supports Intellisense PHP in emacs? As I've set up cedet now and I would like to add autocomplete for PHP code in emacs.
I know you can do it in vim.
Edit: In the past few months I've started using the php-language-server with lsp-mode (which are both components built on Microsoft's Language Server Protocol).
It's not a perfect answer yet, but I have jump-to-definition that's working pretty solidly in a large, old PHP codebase, and that alone is worth quite a bit. Other components like docstring/function signature display and completion-at-point
work too (though neither of those are perfect yet).
This direction looks more promising to me than any of the options in my original answer, because when an LSP backend improves, all editors benefit from it, so the core backend intelligence should get gains from a wider community. Similarly, improvements and extensions to lsp-mode should benefit integration with other language backends, not just the one it was originally built for.
Disclosure: I have contributed some to this solution. I submitted a PR to make emacs-lsp compatible with php-language-server and hacked up my own simple PHP backend, which I replaced with the lsp-php package when it popped up one day in my list-packages buffer.
I have yet to find a fully satisfactory solution for PHP intelligence in Emacs, but here's what I have found.
auto-complete is similar to company-mode
in that it provides a UI for autocompletion. I prefer its UI to company-mode
's - try both and see what you like.
php-auto-yasnippets is useful for auto-completion of built-in PHP functions, complete with argument order.
pfff is a static analysis tool with good PHP support. Its stags command will generate Emacs tags files, which can then be used for jumping to definitions. You should be able to use this to get some sort of auto-completion too, but I don't know how useful it would really be.
Finally, emacs-eclim uses Eclipse as a code-intelligence daemon. It works very well for Java, and in principle it's possible to install Eclipse's PDT plugin and use eclim for PHP completion and jump-to-definition. The last time I tried it, the PHP support in the Emacs plugin was pretty limited. Some elisp hacking would probably get you there.
If I were going back to this personally, I'd probably work on emacs-eclim PHP support. I think it's the solution that's most likely to work well, and PDT seems to make steady progress forward.
If you install php-ext (https://savannah.nongnu.org/projects/php-ext-el/), you will have autocompletion and skeleton templates for many, many php functions:
$ cd ~
$ mkdir mydir
$ cd mydir
$ git clone git://git.savannah.nongnu.org/php-ext-el.git
Edit you .emacs and add:
(setq php-ext-path "~/mydir")
(load (concat php-ext-path "php-ext.el"))
company-mode
as an "intellisense" frontend. I don't know of any intelligent scope-aware completion backends, but keywords, dabbrev, and other methods may suffice.