Version 1.2 - Released Dec. 24, 2015.
A [GNU Emacs](https://www.gnu.org/software/emacs/) add-on. It's mostly just perl-mode.el from the Emacs 24.5 source code folder location
...modified in a very primitive way by Apollia around late Dec. 20 and early Dec. 21, 2015, just to make perl-mode be able to masquerade as [php-mode](https://github.com/ejmr/php-mode).
And on Dec. 22, 2015, I (Apollia) added some small pieces of the real php-mode, to make some more php-mode-dependent things work properly.
Please be cautious with perly-php-mode - I only started seriously using Emacs in early Nov. 2015 and don't know what kind of problems I might have unwittingly created.
At first, all I did was search for all text in perl-mode.el that said "perl-" and replaced it with "php-".
Why? Because the real [php-mode](https://github.com/ejmr/php-mode) makes one of my most crucial Emacs add-ons, multifiles-apmod.el, very slow when working with large PHP multifiles:
I found that perl-mode worked much faster than php-mode with my large PHP multifiles, and even handles a lot of the syntax coloring surprisingly well.
But, a drawback of perl-mode is that various php-mode-dependent add-ons I have won't work with perl-mode.
So, I needed to fool those add-ons into thinking I was running php-mode even though I wasn't.
I'm surprised this even worked! There are probably still plenty of things that don't yet completely work (or which don't even work at all), but, not much I've noticed the absence of yet.
Now, thanks to this trick, I have PHP autocomplete, pop-up documentation in my PHP files, and more, despite really running perl-mode.
On Dec. 22, 2015, I added a new script, "from-real-php-mode.el", containing a little code from the real php-mode, which makes Eldoc and [php-auto-yasnippets](https://github.com/ejmr/php-auto-yasnippets) work.
But even before I added that, I noticed that which-function-mode and a nice PHP imenu add-on I found at [http://www.oak.homeunix.org/~marcel/blog/2008/07/18/nested-imenu-for-php](http://www.oak.homeunix.org/~marcel/blog/2008/07/18/nested-imenu-for-php) already sometimes worked with some (but not all) of my PHP files.
(By the way, I'm quite impressed that that imenu add-on, which is from 2008, still works quite well in Emacs!)
I think the problem with the files those didn't work in probably resulted from the fact that PHP-style comments such as // and /* */ confuse perl-mode.
Fortunately, that problem is easy to fix just by changing // and /* */ comments to comments prefixed with # on every line, a comment style which both PHP and Perl accept.
Also, HTML sections with apostrophes confuse perl-mode (and perly-php-mode) and mess up the syntax coloring. So, to temporarily fix that, I add this immediately after such apostrophes:
I didn't use or study the real [php-mode](https://github.com/ejmr/php-mode) long enough to get really familiar with its features. So, perly-php-mode might be missing some important things that I don't even know about.
perly-php-mode is definitely missing automatic indent tailored to PHP. But, if you're like me, you won't mind.
It looks like perl-mode does have some sort of indent-related code which I'd probably dislike if I didn't have something which can override it. But fortunately, it doesn't bother me at all, thanks to this:
The missing feature I most want is a bit more PHP-specific syntax coloring.
I wish I knew how to make the real [php-mode](https://github.com/ejmr/php-mode) compatible with [multifiles-apmod-el](https://github.com/Apollia/multifiles-apmod.el).
I suspect the root of the problem might lie somewhere in c-mode, since multifiles are slow not only in [php-mode](https://github.com/ejmr/php-mode) but in c-mode, and php-mode's source code says php-mode inherits a lot from c-mode.
If you have [php-mode](https://github.com/ejmr/php-mode) installed already, you'll probably need to uninstall it before installing perly-php-mode.
Code to put in one of your Emacs settings files, like .emacs or init.el:
; And below is a snippet from the real php-mode which will make
; perly-php-mode automatically be activated when you open files
; matching the below patterns.
; Slightly modified by me because I have a bunch of PHP-GTK files with the
; extension .phpg, and some PHP console scripts with the extension .phpb.
(pattern '("\\.php[s345tgb]?\\'" "\\.phtml\\'" "Amkfile" "\\.amk$") )
(add-to-list 'auto-mode-alist `(,pattern . php-mode) t)
Optionally, you can manually activate perly-php-mode by typing:
Thanks to everyone who wrote the code used in this - all the authors of and contributors to perl-mode and [php-mode](https://github.com/ejmr/php-mode)! I scarcely changed a thing.
If I had had to build everything from scratch, I never would have been able to put together such a surprisingly satisfactory substitute for php-mode in so little time.
Splicing this all together from existing code took probably less than an hour in all. Even writing the Readme text took longer.