Skip to content

Update Packagist with GitHub webhooks without Service

In April this year GitHub announced that it would deprecate the GitHub Service feature, which currently is the recommended way to setup a Packagist package with GitHub. Don’t worry, you still have plenty of time… GitHub is not going to discontinue this feature till the beginning of 2019, but if you’re currently setting up GitHub with packagist, then you might want to do it already the new way.

The official Packagist documentation lacks instructions on how to setup automatic updating of Packagist using GitHub WebHooks. Here’s how you do it:

1. Go to your GitHub repository and select Settings -> WebHooks

2. As the PayLoad URL type in

https://packagist.org/api/update-package?username=kgoedecke&apiToken=XYZ

Replace XYZ with your API Token, see your Packagist profile for your API token.

3. Content-Type needs to be application/json

4. Insert the following into secret, this is the actual JSON payload:

json {"repository":{"url":"PACKAGIST_PACKAGE_URL"}}

Don’t forget to replace PACKAGIST_PACKAGE_URL  with the URL of your package e.g. https://packagist.org/packages/user/some-package

5.Now you can select which events should trigger the actual push to Packagist.

6. You’re done, this is how it should look like:

Published inUncategorized

10 Comments

  1. Anonymous

    Thanks. Couldn’t find anything on how to setup github webhooks with packagist.

  2. Francisco

    Thanks!!! It helped me!!

  3. Ako

    Thank you very much. I didn’t find anything about how to configure github webhooks with Packagists, your post helped me.
    Thank you again.

  4. Nimayneb

    Thanks for your post. I also didn’t find anything about the migration of Webhooks for packagist… But I was really wondering… is this really a good approach for packagist Webhook? I cannot see which Packagist-Package-URL I have implemented via the “secret” string. What the heck?

    But the other problem is: I still have “Legacy Auto-Updated” and “Not Auto-Updated” with the “Needs Attention” hint on packagist account…

  5. Nimayneb

    Ehm. okay, my fault. I need one webhook for one repository of course. just confusing me first. 😉

  6. Mike

    You didn’t specify which events are required nor the checkboxes are visible on the screenshot.

  7. Some guy from Sweden

    While I was happy about your guide, it seems like Github itself has replaced all my packagist-services with the matching webhooks automatically. The only thing I had to do was to log in to Packagist using my Github account.

    Maybe your guide could reflect that as a simple alternative. This article was my first search result Google found for me (well done!) and more people like me will probably drop by in the beginning of 2019.

  8. As for 2019, the article must be updated with the latest information from Packagist.

    You can configure a GitHub webhook manually by using the following values:

    Payload URL: https://packagist.org/api/github?username=PACKAGIST_USERNAME
    Content Type: application/json
    Secret: your Packagist API Token
    Which events? Just the push event is enough.

    Be careful, if you use Secret as “json {“repository”:{“url”:”PACKAGIST_PACKAGE_URL”}}” it won’t work.

  9. Another one coming in to point that the current Packagist documentation points to what Serhii said above: https://packagist.org/about#how-to-update-packages
    It would be wise to update the post, as it’s one of the first results in Google searches on the topic.

    And, even though, some of my packages still show the same warning 😐

  10. Holonaut

    There seems to be a simpler way now.

    Just go to https://packagist.org/profile/edit, then on the bottom Click “Connect to Github” and accept the permissions packagist requires.

    Just did that and packages are updating automatically right off the bat.

Leave a Reply

Your email address will not be published. Required fields are marked *