diff --git a/src/Illuminate/Bootstrap/Composer.php b/src/Illuminate/Bootstrap/Composer.php new file mode 100644 index 000000000000..fba8f3d25c13 --- /dev/null +++ b/src/Illuminate/Bootstrap/Composer.php @@ -0,0 +1,42 @@ +getComposer()->getConfig()->get('vendor-dir'); + require $vendorDir . '/autoload.php'; + + static::clearCompiled(); + } + + public static function postUpdate(Event $event) + { + $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); + require $vendorDir . '/autoload.php'; + + static::clearCompiled(); + } + + private static function clearCompiled() + { + $baseDir = getcwd(); + $laravel = new Application($baseDir); + + $compiledPath = $laravel->getCachedCompilePath(); + $servicesPath = $laravel->getCachedServicesPath(); + + if (file_exists($compiledPath)) { + @unlink($compiledPath); + } + + if (file_exists($servicesPath)) { + @unlink($servicesPath); + } + } +}