Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

imBee's avatar
Level 1

PHP 7.4 and Preloading Laravel

Hi,

So since the third RC of PHP7.4 is released and has Preloading: https://wiki.php.net/rfc/preload

I was curious, which parts of the Laravel framework can we pass to the opcache_compile_file() function?

Can the whole vendor folder passed there? If so, how will that affect the performance, will it turn Laravel into Phalcon? :D

0 likes
4 replies
bobbybouwmann's avatar

You can probably put your whole application in there, you need to clear the cache on every deployment anyway. But normally I would start with just the vendor directory as well ;)

jonassiewertsen's avatar
Level 14

I heard a PHP talk by Rasmus L. (Creator of PHP), covering as well a few functions about PHP 7.4

He said that there will be performance improvements by preloading the framework, but not that drastically. If i remember correctly, he said something about 10%. (Maybe someone else has a source?) This information is a few month old.

2 likes
imBee's avatar
Level 1

Thank you very much, I was kind of disappointed that the improvement is only 10% :(

I was hoping since everything is pre-compiled and available in ram, it would act like Phalcon...

Still not sure why Phalcon is so much faster (I know it's written in C, but here we have the PHP compiled to machine language as well)

phillipelm's avatar

PHP 7.4 doesn't include JIT or any sort of native compilation. That stuff is in the works for PHP 8.

Preloading in 7.4 is built around opcache, which stores interpreter opcodes; not native instructions.

From the RFC:

It aims to provide users with the ability to trade in some of the flexibility that the conventional PHP model provides them, for increased performance. On server startup before any application code is run we may load a certain set of PHP files into memory - and make their contents "permanently available" to all subsequent requests that will be served by that server.

Please or to participate in this conversation.