Skip to content

Conversation

@IgorBenko
Copy link
Contributor

A PR for the menu entry will be created separately.

@IgorBenko IgorBenko requested a review from a team December 9, 2025 14:19
Comment on lines +1 to +6
# Reading package metadata via API

To read the package metadata via API, use the Composer API on your Private Packagist repository.

Read more about the API: https://packagist.org/apidoc#get-package-data

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you expand the introduction a bit more, so that its more findable via search engines.
E.g. why do i need that? What was the scenario the customer needed that? (if you have the context). Cause if I only read that i dont know if the article applies to me and if I should read it.

Comment on lines +7 to +8
### Example implementation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i would do one stanza on meta level like

  • get the JSON from https://repo.packagist.com//p2/.json
    • using username "token" and an Authentication Token as password
  • decode the json as nested arrays
  • use [MetadataMinifier(https://link.to.metadata.miniifier.com) to expand the metadata for each package version $metadata = MetadataMinifier::expand($data['packages'][$package]);

just like the TL;DR? :)

// You can create a token in your Organization settings > Authentication Tokens
$token = 'packagist_ort_..........';

$apiUrl = sprintf('https://repo.packagist.com/%s/p2/%s.json', $organization, $package);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have to think about the dev versions as well? (this is only stable, right?) with ~dev.json ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants