Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Sithu's avatar
Level 14

PHP Warning when I run "laravel new newApp" from command line

Today when I run

laravel new newApp

I got this error.

Crafting application...
PHP Warning:  ZipArchive::extractTo(): Invalid or unitialized Zip object in /home/sithuaung/.composer/vendor/laravel/installer/src/NewCommand.php on line 114
PHP Warning:  ZipArchive::close(): Invalid or unitialized Zip object in /home/sithuaung/.composer/vendor/laravel/installer/src/NewCommand.php on line 116
Composer could not find a composer.json file in /home/sithuaung/Sites/blog
To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section
Application ready! Build something amazing.

Can someone tell me why is that?

0 likes
4 replies
Sithu's avatar
Level 14
  1. Version
Laravel Installer version 1.2.0
  1. I followed the instruction from l5 documentation.
composer global require "laravel/installer=~1.1"

then I add PATH to my ~/.bashrc file. ( I'm on ubuntu).

  1. No, I got plain directory which doesn't include any file.
MulryTime's avatar

This error is because the zip archive with the source code is not found. Upgrade your laravel installer. If you need to make a new project of an older version of laravel, you will need to use composer create-project command.

rajeshkumarraj82's avatar

I can able to debug and resolve this issue. It turns out to be a network issue(firewall) for me!

I observed the command “laravel new <project_name>” is working fine in my home network but I am getting the following error in office network,

PHP Warning:  ZipArchive::extractTo(): Invalid or unitialized Zip object in C:\Users\Rajesh Kumar Raj\AppData\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php on line 157

So, I decided to debug the NewCommand.php file.

I noticed the following function is trying to download a zip file by calling the URL http://cabinet.laravel.com/latest.zip

protected function download($zipFile, $version = 'master')
{
    switch ($version) {
        case 'develop':
            $filename = 'latest-develop.zip';
            break;
        case 'master':
            $filename = 'latest.zip';
            break;
    }

    $response = (new Client)->get('http://cabinet.laravel.com/'.$filename);

    file_put_contents($zipFile, $response->getBody());

    return $this;
}

I tried typing the URL in my browser and I got a firewall error since the URL includes a .zip extension. So, I asked my network administrator to exclude check for this URL.

Then the project got created successfully without any issues.

So, the solution is, try accessing the URL (http://cabinet.laravel.com/latest.zip) from your browser. If it’s not working contact network admin or try executing the command from your home/mobile network.

Hope this helps. Thank You.

Please note, I am using Composer version 1.5.2 and Laravel Installer Version 1.4

Please or to participate in this conversation.