Pagekit\Installer\Package\PackageManager::uninstall PHP Method

uninstall() public method

public uninstall ( array $uninstall ) : boolean
$uninstall array
return boolean
    public function uninstall($uninstall)
    {
        foreach ((array) $uninstall as $name) {
            if (!($package = App::package($name))) {
                throw new \RuntimeException(__('Unable to find "%name%".', ['%name%' => $name]));
            }
            $this->disable($package);
            $this->getScripts($package)->uninstall();
            App::config('system')->remove('packages.' . $package->get('module'));
            if ($this->composer->isInstalled($package->getName())) {
                $this->composer->uninstall($package->getName());
            } else {
                if (!($path = $package->get('path'))) {
                    throw new \RuntimeException(__('Package path is missing.'));
                }
                $this->output->writeln(__("Removing package folder."));
                App::file()->delete($path);
                @rmdir(dirname($path));
            }
        }
    }

Usage Example

 /**
  * @Request({"name"}, csrf=true)
  */
 public function uninstallAction($name)
 {
     return App::response()->stream(function () use($name) {
         try {
             $this->manager->uninstall($name);
             echo "\nstatus=success";
         } catch (\Exception $e) {
             printf("%s\nstatus=error", $e->getMessage());
         }
     });
 }
All Usage Examples Of Pagekit\Installer\Package\PackageManager::uninstall