1

I came across this post from a few years ago discussing pro & con of PHAR in PHP deployments. One of the main issues then was lack of APC support for PHAR. Besides for large scale deployments of widely used tools, I don't see much PHAR use in the wild in end user applications.

Is the era of PHAR over? Besides deployment ease, is there any speed benefit today to using PHAR? Does PHP 7 support caching PHAR?

Update: Today I located the following in the PHP source code, which implies that PHAR is opcode cached: Lines 152-156

ethanpil
  • 2,522
  • 2
  • 24
  • 34
  • Well composer is available for download as a phar, as are many tools like phpunit, and those used for static analysis such as phpmd and pdepend – Mark Baker Oct 26 '16 at 15:43
  • @MarkBaker thats a benefit in regards to distribution/deployment. I am wondering more about speed. I will clarify my question test. – ethanpil Oct 27 '16 at 01:55
  • IMO it has been entirely supplanted by Composer. – ceejayoz Oct 27 '16 at 02:02
  • This was the first related question, might add more details http://stackoverflow.com/questions/3521484/advantages-of-phar-archives-in-php?rq=1 – Jessedc Oct 27 '16 at 02:12
  • 3
    There aren't any significant benefits to speed, or to memory usage; you're still executing the same PHP code that you would if it wasn't a phar, and it will still be opcached in the same way as a suite of files; the benefit is a single file distribution/deployment – Mark Baker Oct 27 '16 at 06:57
  • I was always under the impression that there is a noticeable overhead when decoding a .phar vs loading php files but I don't remember where I got this feeling from... – ethanpil Nov 02 '16 at 14:48

0 Answers0