composer / composer/packagist

[Suggestion] Filter on framework versions

Open
#1,048 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
1.8k
Forks
488
Avg merge
2d 21h
Merged PRs (30d)
32

Description

Hello there, has I suggested recently on the Symfony Devs Slack, I think it would be very useful to have the possibility to filter packages by framework specific version.

## Why should you add that?
This feature would be very helpful for developers who seek to find a package compatible with a specific version of a framework.
By example, if someone wants to build a website with Symfony 5 (who has just been released), will find all available packages compatible with this major version.
This feature will be also really helpful when a new major version of a framework (Symfony) has just been released and developers who want to contribute to make this package compatible with this new major version will be able to find package who need to be upgraded.

## Is keywords can do the job?
Has proposed by someone could be used to filter specific version of Symfony by example.
However this means each package author need to had the "perfect" keyword in the `composer.json` file to be able to have a filtering system 100% accurate.

## How could you achieve this?
The best way to achieve this goal would be to parse the packages listed in `composer.json` under the `require` and ` require-dev` keys and analyse the version required.
The parser would also need to check the package type `symfony-bridge`, `symfony-bundle`.
Let's take a example with the next `composer.json` file from `symfony/monolog-bundle`:
```json
{
"type": "symfony-bridge",
"require": {
"php": ">=5.6",
"symfony/monolog-bridge": "~3.4 || ~4.0 || ^5.0",
"symfony/dependency-injection": "~3.4.10 || ^4.0.10 || ^5.0",
"symfony/config": "~3.4 || ~4.0 || ^5.0",
"symfony/http-kernel": "~3.4 || ~4.0 || ^5.0",
"monolog/monolog": "~1.22 || ~2.0"
},
"require-dev": {
"symfony/yaml": "~3.4 || ~4.0 || ^5.0",
"symfony/console": "~3.4 || ~4.0 || ^5.0",
"symfony/phpunit-bridge": "^3.4.19 || ^4.0 || ^5.0"
},
}
```
This package seems to be compatible with the next versions of Symfony: **3.4**, **4.0** and **5.0** due to the dependencies versions listed above but also because the type is **symfony-bridge**.
So with this information, a user will be able to filter packages by specifying the Symfony version **3.4**, **4.0** or **5.0**.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing how package metadata from composer.json is parsed, especially the require and require-dev entries and the symfony-bridge or symfony-bundle package types. Define how framework versions should be extracted and exposed as filters; done means packages can be filtered accurately by versions such as Symfony 3.4, 4.0, and 5.0.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.