Search code examples
phplaravelcomposer-phplaravel-package

cant install swagger package using laravel


when i try to install swagger package i got this warrning

Failed to download swagger-api/swagger-ui from dist: The zip extension and unzip/7z commands are both missing, skipping. The php.ini used by your command-line PHP is: D:\xampp\php\php.ini Now trying to download from source

and after a while i got this error

In Process.php line 1204: The process "git clone --no-checkout -- https://github.com/swagger-api/swagger-ui.git D:\xampp\htdocs\laravel-10\vendor\swagger-api\swagger-ui && c
d /D D:\xampp\htdocs\laravel-10\vendor\swagger-api\swagger-ui && git remote add composer -- https://github.com/swagger-api/swagger-ui.git && git fe
tch composer && git remote set-url origin -- https://github.com/swagger-api/swagger-ui.git && git remote set-url composer -- https://github.com/swa
gger-api/swagger-ui.git" exceeded the timeout of 300 seconds.


Solution

  • You have two issues here.

    1. ZIP extension is missing. (The zip extension and unzip/7z commands are both missing, skipping)
    2. Composer timeout. (exceeded the timeout of 300 seconds.)

    For first error

    1. Open your php.ini file(D:\xampp\php\php.ini).
    2. Find ;extension=zip and remove the semicolon at the beginning.
    3. Save and restart your XAMPP.

    Install https://www.7-zip.org/ if required

    For the second issue

    composer config --global process-timeout 600