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

janmoes's avatar

Laravel passes: Invalid or uninitialized Zip object

Hi there, I'm using this package: https://github.com/chiiya/laravel-passes . Currently I have a working google pass, but I'm running into this error: Invalid or uninitialized Zip object, when creating an Apple pass. I know this is not exactly a Laravel related issue. But their github page does not allow to create discussions or create issues. Currently this is my code ``` public function createApplePass(Request $request) { $uniqueId = uniqid();

    $pass = new GenericPass([
        'serialNumber' => $uniqueId,
        'description' => 'Apple Card',
        'organizationName' => '.',
        'passTypeIdentifier' => '****',
        'teamIdentifier' => '*****',
    ]);

    $barcode = new Barcode([
        'format' => 'PKBarcodeFormatQR',
        'message' => 'https://my.app/sample-url',
        'messageEncoding' => 'iso-8859-1',
    ]);

    $pass->barcodes = [$barcode];
    $pass->backgroundColor = 'rgb(0, 100, 255)';
    $pass->labelColor = 'rgb(255, 255, 255)';

    $logoPath = storage_path('app/public/img/layout/logo.png');

    if (file_exists($logoPath) && mime_content_type($logoPath) === 'image/png') {
        $pass->addImage(new Image($logoPath, ImageType::ICON, 1));
        $pass->addImage(new Image($logoPath, ImageType::LOGO, 1));
    } else {
        throw new \Exception('Icon and logo images must exist at ' . $logoPath . ' and be valid PNG files.');
    }

    // $signedPass = $this->builder->apple()->create($pass);

    $factory = new PassFactory();

    $factory->setCertificate(config('passes.apple.certificate'));
    $factory->setPassword(config('passes.apple.password'));
    $factory->setWwdr(config('passes.apple.wwdr'));
    $factory->setOutput(config('passes.apple.disk'));
    $factory->create($pass, 'filename');

    // return response()->make($signedPass, 200, [
    //     'Content-Type' => 'application/vnd.apple.pkpass',
    //     'Content-Disposition' => 'attachment; filename="pass.pkpass"',
    // ]);
}
0 likes
0 replies

Please or to participate in this conversation.