We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

feature like composer dump-autoload

Phalcon::Loader is becoming the bottleneck in our application due to a lot of classes (namespaces) that needed to scan. Is there a plugin or a way in Phalcon to have something similar with composer's "dump-autoload --classmap-authoritative" ?

Thanks



145.0k
Accepted
answer

Just enable opcache.

If Loader is your only bottleneck, you must have way too many external dependencies. I often see projects with dozen of external libs where people just use the way they're used to from other frameworks. The end result - you're not using Phalcon but Laravel or Symfony framework (performance wise).

OPcache should be your only out of the box solution. Phalcon loader when used properly is the fastest available loader in the PHP world (alongside SPL autoload). Just avoid any includes / requires and use namespaces or classes strategy.

Thanks guys. Yes opcache is the solution here