Skip to content

Add support for PHP libraries on framework.dev #752

Open
@kenslachtajr

Description

@kenslachtajr

Description

  • PHP is not supported out of the box and a research spike was conducted to determine the best way to add support for PHP libraries on framework.dev. This ticket involves and adding support for comparing different PHP libraries based on certain properties. At the end of this text, you can see some suggested properties for comparison which we can use.

  • Adding badges for PHP libraries is an additional need for this ticket. We are able to make use of the same properties in implementing badge functionality as well. Please refer to the original spike ticket for more context: SPIKE: Investigate fixing comparison tool #577

PHP

In PHP, Composer is most often used for managing dependencies. packagist.org is a repository of PHP packages, and they offer an API to get package stats. For example:

// GET https://packagist.org/packages/[vendor]/[package].json

{
  "package": {
    "name": "[vendor]/[package],
    "description": [description],
    "time": [packagist package creation datetime],
    "maintainers": [list of maintainers],
    "versions": [list of versions and their dependencies, the same data of composer.json]
    "type": [package type],
    "repository": [repository url],
    "downloads": {
      "total": [numbers of download],
      "monthly": [numbers of download per month],
      "daily": [numbers of download per day]
    },
    "favers": [number of favers]
    ...
  }
}

If the package is hosted on GitHub, additional properties are returned:

    "github_stars": X,
    "github_watchers": Y,
    "github_forks": Z,
    "github_open_issues": M,

Working example: https://packagist.org/packages/monolog/monolog.json

Some stats we could consider for framework.dev in the context of Packagist:

  • package.downloads.monthly
  • package.github_stars
  • package.favers (see below)
  • package.dependents (see below)
  • package.suggesters (see below)

Favers refers to the number of users who have marked a package as a favorite on the Packagist website. This feature allows users to keep track of packages they find useful or interesting, and can also be used as a way to discover new packages that have been well-received by the community. The number of "favers" for a package can be an indication of its popularity and usefulness.

Dependents in Packagist refers to the number of other packages that depend on a given package. This means that the dependent packages have specified the package as a requirement in their own composer.json file and thus have a dependency on it.

Suggests is a way for package maintainers to suggest other packages that may be used with the package they are publishing but are not required for it to function. It's a way to give users a heads-up of what else they might find useful. Suggesters is a number of package maintainers that have suggested this package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions