neutrino/optimizer

The Neutrino Optimizer package.

0.1.2 2017-05-29 13:05 UTC

This package is auto-updated.

Last update: 2024-04-20 13:03:47 UTC


README

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}"