Implement packager and installer hooks
[pharext/pharext] / src / pharext / Installer.php
index f6c7807063be73616c162e390a7c95fd8b68aacf..626cfa6a95b30f0254f9f1e290bd89864ce670f6 100644 (file)
@@ -40,6 +40,13 @@ class Installer implements Command
         * @see \pharext\Command::run()
         */
        public function run($argc, array $argv) {
+               if (($hook = stream_resolve_include_path("pharext_install.php"))) {
+                       $callable = include $hook;
+                       if (is_callable($callable)) {
+                               $recv = $callable($this);
+                       }
+               }
+               
                $errs = [];
                $prog = array_shift($argv);
                foreach ($this->args->parse(--$argc, $argv) as $error) {
@@ -69,6 +76,10 @@ class Installer implements Command
                        exit(1);
                }
                
+               if (isset($recv)) {
+                       $recv($this);
+               }
+               
                $this->installPackage();
        }