Skip to content

Optimize the composer autoload by using Phalcon\Loader

License

Notifications You must be signed in to change notification settings

wydhit/optimizer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neutrino : Optimizer component

Build Status Coverage Status

Optimize the composer autoload by using Phalcon\Loader.

How use :

$composerOptimizer = new \Neutrino\Optimizer\Composer(
    '{path to optimized loader file}',
    '{path to vendor/composer}',
    '{path to your base application path}',
);

Optimize Memory

$composerOptimizer->optimizeMemory();

Memory optimizer use composer dumpautoload without " --optimize ".

This significantly reduces the size of the autoload_classmap.php file and therefore the size of the generated file. This implies that the classes will not have a direct path to their file, and thus an additional processing on the part of the autoloader (Phalcon \ Loader).

Optimize Process

$composerOptimizer->optimizeProcess();

Process optimizer use composer dumpautoload with " --optimize ".

This allows to load the autoload with the link each used. This generates a huge array that will accelerate the loading process of the class.

Autoload :

In your bootstrap file, Change your call of composer/autoload.php by :

// Load compiled autoloader. (Phalcon)
if (file_exists("{path to optimized loader file}")) {
  require "{path to optimized loader file}";

  return;
}

/**
 * Load composer autoloader.
 */
require "{path to vendor/composer/autoload.php}"

About

Optimize the composer autoload by using Phalcon\Loader

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%