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

Daniel-Pablo's avatar

Installing Spatie media-library and Spatie-Comments from zip and manage auth.json

Hello I have 2 problems, can you help me?

  1. Spatie ask to install their packs with this auth.json
{
    "http-basic": {
        "satis.spatie.be": {
            "username": "<YOUR-SPATIE.BE-ACCOUNT-EMAIL-ADDRESS-HERE>",
            "password": "<YOUR-LICENSE-KEY-HERE>"
        }
    }
}

I have 2 licenses one for comments and the other for the media library so HOW do I put BOTH?

okay, that's the first issue, now the second one is that my pack EXPIRE the date so now I need to install this pack with a ZIP file but HOW? I install all with composer never install with ZIPs... thanks in advance for your help.

0 likes
5 replies
LaryAI's avatar
Level 58

To address your first issue regarding the auth.json file for multiple licenses, you can simply add multiple entries under the http-basic key. Each entry should correspond to a different Spatie package repository if they are indeed separate. However, if both licenses are for packages from the same repository, you would typically use the same credentials for both. Here's how you can structure your auth.json:

{
    "http-basic": {
        "satis.spatie.be": {
            "username": "<YOUR-SPATIE.BE-ACCOUNT-EMAIL-ADDRESS-HERE>",
            "password": "<YOUR-COMMON-LICENSE-KEY-HERE>"
        }
    }
}

If you have different repositories for each package, you would add them like so:

{
    "http-basic": {
        "media-library.satis.spatie.be": {
            "username": "<YOUR-SPATIE.BE-ACCOUNT-EMAIL-ADDRESS-HERE>",
            "password": "<YOUR-MEDIA-LIBRARY-LICENSE-KEY-HERE>"
        },
        "comments.satis.spatie.be": {
            "username": "<YOUR-SPATIE.BE-ACCOUNT-EMAIL-ADDRESS-HERE>",
            "password": "<YOUR-COMMENTS-LICENSE-KEY-HERE>"
        }
    }
}

For the second issue, installing a package from a ZIP file can be done by modifying your composer.json to include the path to the ZIP file using the repositories key and then requiring the package as usual. Here's how you can do it:

  1. Add the local repository to your composer.json:
{
    "repositories": [
        {
            "type": "artifact",
            "url": "path/to/directory/with/zips/"
        }
    ]
}
  1. Place your ZIP file(s) in the directory specified above.

  2. Require the package using Composer:

composer require spatie/media-library
composer require spatie/comments

Composer will look for the packages in the directories specified. If it finds the ZIP files there, it will use them instead of downloading from Packagist.

Remember to replace spatie/media-library and spatie/comments with the actual package names and versions you are trying to install, if they are different.

Please note that using ZIP files for package installation is less common and might not provide the same ease of updates as using Composer with a repository. It's also important to ensure that the ZIP files contain the correct directory structure expected by Composer.

Daniel-Pablo's avatar

this is not clear

{
    "http-basic": {
        "media-library.satis.spatie.be": {
            "username": "<YOUR-SPATIE.BE-ACCOUNT-EMAIL-ADDRESS-HERE>",
            "password": "<YOUR-MEDIA-LIBRARY-LICENSE-KEY-HERE>"
        },
        "comments.satis.spatie.be": {
            "username": "<YOUR-SPATIE.BE-ACCOUNT-EMAIL-ADDRESS-HERE>",
            "password": "<YOUR-COMMENTS-LICENSE-KEY-HERE>"
        }
    }
}

I don't know if I should put it at the start of the name media-library... and the other one comments... and the reason is that look at these 2 links they are the same thing and they are not showing anything about making that difference...

https://spatie.be/docs/laravel-medialibrary/v9/handling-uploads-with-media-library-pro/installation#content-requiring-media-library-pro

this calls the same auth.json as this one

https://spatie.be/docs/laravel-comments/v1/installation-setup#content-getting-a-license

in both links they call this same auth

{
    "http-basic": {
        "satis.spatie.be": {
            "username": "<YOUR-SPATIE.BE-ACCOUNT-EMAIL-ADDRESS-HERE>",
            "password": "<YOUR-LICENSE-KEY-HERE>"
        }
    }
}

any help is more than welcome

Daniel-Pablo's avatar

I want to Quote this answer from Spatie support:

in your auth.json, it's fine to put one of the keys in, our license server will understand that you should have access to both products. -> Freek Van der Herten, creator of Spatie plugins

So based on that you need just ONE LICENSE KEY - Okay question 1 is solved now I will move on to how to install this as a zip file

Daniel-Pablo's avatar
Daniel-Pablo
OP
Best Answer
Level 12

okay for the second part THE INSTALLATION OF THE PACK, via GitHub private repository in your GitHub

  1. download spatie zip and unzip the files
  2. put all the content (all unzipped files) into your PRIVATE repository,

put this in your project composer.json file

   "require": {
        "yourGitAccountName/spatiePack": "dev-main",
//...... more stuff here all your packs from composer....
}
   "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/yourGitAccountName/spatiePack.git"
        }
    ],

okay now the important part: 3. go to the private repository(the cloned one) spatie pack and inside the composer.json file you must change the name from : spatie/name-of-the-pack to

{
    "name": "yourGitAccountName/spatiePack",
}

this must match when you REQUIRE the pack via composer

so you can now write the following composer require yourGitAccountName/spatiePack you see, now is matching and now you can pull it down

Daniel-Pablo's avatar

if you are going to install the LIVEWIRE PACK you must change this on the composer.json private repository

    "require": {
        "yourGitUserName/laravel-comments": "dev-main",
// other stuff
    },

Please or to participate in this conversation.