[
  {
    "path": ".gitattributes",
    "content": "/.github export-ignore\n/test export-ignore\n.gitattributes export-ignore\n.gitignore export-ignore\nphpcs.xml.dist export-ignore\nphpunit.xml.dist export-ignore\npsalm.xml export-ignore\ninfection.json.dist export-ignore\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: [Ocramius]\ntidelift: \"packagist/ocramius/package-versions\"\n"
  },
  {
    "path": ".github/workflows/continuous-integration.yml",
    "content": "# See https://github.com/laminas/laminas-continuous-integration-action\n# Generates a job matrix based on current dependencies and supported version\n# ranges, then runs all those jobs\nname: \"Continuous Integration\"\n\non:\n  pull_request:\n  push:\n\njobs:\n  matrix:\n    name: Generate job matrix\n    runs-on: ubuntu-latest\n    outputs:\n      matrix: ${{ steps.matrix.outputs.matrix }}\n    steps:\n      - name: Gather CI configuration\n        id: matrix\n        uses: laminas/laminas-ci-matrix-action@cb19bb402f3be76292a08b6632e1ecdb9fdd22bc # 1.31.0\n\n  qa:\n    name: QA Checks\n    needs: [ matrix ]\n    runs-on: ${{ matrix.operatingSystem }}\n    strategy:\n      fail-fast: false\n      matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}\n    steps:\n      - name: ${{ matrix.name }}\n        uses: laminas/laminas-continuous-integration-action@5f4512e23ab587455e9f0a39e4616dad4550de4f # 1.43.0\n        env:\n          \"GITHUB_TOKEN\": ${{ secrets.GITHUB_TOKEN }}\n          \"INFECTION_DASHBOARD_API_KEY\": ${{ secrets.INFECTION_DASHBOARD_API_KEY }}\n          \"STRYKER_DASHBOARD_API_KEY\": ${{ secrets.STRYKER_DASHBOARD_API_KEY }}\n        with:\n          job: ${{ matrix.job }}\n"
  },
  {
    "path": ".github/workflows/release-on-milestone-closed.yml",
    "content": "# https://help.github.com/en/categories/automating-your-workflow-with-github-actions\n\nname: \"Automatic Releases\"\n\non:\n  milestone:\n    types:\n      - \"closed\"\n\njobs:\n  release:\n    name: \"GIT tag, release & create merge-up PR\"\n    runs-on: ubuntu-latest\n\n    steps:\n      - name: \"Checkout\"\n        uses: \"actions/checkout@v6\"\n\n      - name: \"Release\"\n        uses: \"laminas/automatic-releases@1.25.0\"\n        with:\n          command-name: \"laminas:automatic-releases:release\"\n        env:\n          \"GITHUB_TOKEN\": ${{ secrets.GITHUB_TOKEN }}\n          \"SIGNING_SECRET_KEY\": ${{ secrets.SIGNING_SECRET_KEY }}\n          \"GIT_AUTHOR_NAME\": ${{ secrets.GIT_AUTHOR_NAME }}\n          \"GIT_AUTHOR_EMAIL\": ${{ secrets.GIT_AUTHOR_EMAIL }}\n\n      - name: \"Create Merge-Up Pull Request\"\n        uses: \"laminas/automatic-releases@v1\"\n        with:\n          command-name: \"laminas:automatic-releases:create-merge-up-pull-request\"\n        env:\n          \"GITHUB_TOKEN\": ${{ secrets.GITHUB_TOKEN }}\n          \"SIGNING_SECRET_KEY\": ${{ secrets.SIGNING_SECRET_KEY }}\n          \"GIT_AUTHOR_NAME\": ${{ secrets.GIT_AUTHOR_NAME }}\n          \"GIT_AUTHOR_EMAIL\": ${{ secrets.GIT_AUTHOR_EMAIL }}\n\n      - name: \"Create and/or Switch to new Release Branch\"\n        uses: \"laminas/automatic-releases@v1\"\n        with:\n          command-name: \"laminas:automatic-releases:switch-default-branch-to-next-minor\"\n        env:\n          \"GITHUB_TOKEN\": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}\n          \"SIGNING_SECRET_KEY\": ${{ secrets.SIGNING_SECRET_KEY }}\n          \"GIT_AUTHOR_NAME\": ${{ secrets.GIT_AUTHOR_NAME }}\n          \"GIT_AUTHOR_EMAIL\": ${{ secrets.GIT_AUTHOR_EMAIL }}\n\n      - name: \"Bump Changelog Version On Originating Release Branch\"\n        uses: \"laminas/automatic-releases@v1\"\n        with:\n          command-name: \"laminas:automatic-releases:bump-changelog\"\n        env:\n          \"GITHUB_TOKEN\": ${{ secrets.GITHUB_TOKEN }}\n          \"SIGNING_SECRET_KEY\": ${{ secrets.SIGNING_SECRET_KEY }}\n          \"GIT_AUTHOR_NAME\": ${{ secrets.GIT_AUTHOR_NAME }}\n          \"GIT_AUTHOR_EMAIL\": ${{ secrets.GIT_AUTHOR_EMAIL }}\n\n      - name: \"Create new milestones\"\n        uses: \"laminas/automatic-releases@v1\"\n        with:\n          command-name: \"laminas:automatic-releases:create-milestones\"\n        env:\n          \"GITHUB_TOKEN\": ${{ secrets.GITHUB_TOKEN }}\n          \"SIGNING_SECRET_KEY\": ${{ secrets.SIGNING_SECRET_KEY }}\n          \"GIT_AUTHOR_NAME\": ${{ secrets.GIT_AUTHOR_NAME }}\n          \"GIT_AUTHOR_EMAIL\": ${{ secrets.GIT_AUTHOR_EMAIL }}\n"
  },
  {
    "path": ".gitignore",
    "content": "/vendor/\n/clover.xml\n/phpcs.xml\n/.phpcs-cache\n"
  },
  {
    "path": ".laminas-ci.json",
    "content": "{\n  \"extensions\": [\n    \"pcov\"\n  ],\n  \"ini\": [\n    \"memory_limit=-1\"\n  ],\n  \"exclude\": [\n    {\"name\": \"Infection [8.2, locked]\"}\n  ],\n  \"additional_checks\": [\n    {\n      \"name\": \"Infection (with PCOV)\",\n      \"job\": {\n        \"php\": \"8.4\",\n        \"dependencies\": \"locked\",\n        \"command\": \"./vendor/bin/roave-infection-static-analysis-plugin\"\n      }\n    }\n  ],\n  \"ignore_php_platform_requirements\": {\n    \"8.5\": true\n  }\n}"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# CHANGELOG\n\n## 2.0.0 - 2020-08-21\n\nThis release turns the package into a library (previously, it was\na composer plugin).\n\nRelevant change is that the `PackageVersions\\Versions::ROOT_PACKAGE_NAME`\nconstant no longer exists: please use `PackageVersions\\Versions::rootPackageName()`\ninstead.\n\nThis slims down the complexity of the package massively, and removes\nmultiple known bugs.\n\nTotal issues resolved: **5**\n\n- [107: Unable to install on vboxfs](https://github.com/Ocramius/PackageVersions/issues/107) thanks to @alexgit2k\n- [138: `src/Packages/Versions.php` changes detected in `composer install`](https://github.com/Ocramius/PackageVersions/issues/138) thanks to @Taluu\n- [142: Option to ignore version of rootPackage](https://github.com/Ocramius/PackageVersions/issues/142) thanks to @qurben\n- [152: Ocramius/PackageVersions is not compatible with composer configuration &quot;lock: false&quot;](https://github.com/Ocramius/PackageVersions/issues/152) thanks to @windaishi\n- [155: BC break: removed deprecated `PackageVersions\\Versions::ROOT_PACKAGE_NAME` constant](https://github.com/Ocramius/PackageVersions/pull/155) thanks to @Ocramius\n\n## 2.12.0 - TBD\n\n### Added\n\n- Nothing.\n\n### Changed\n\n- Nothing.\n\n### Deprecated\n\n- Nothing.\n\n### Removed\n\n- Nothing.\n\n### Fixed\n\n- Nothing.\n\n## 2.11.0 - 2025-11-27\n\n\n-----\n\n### Release Notes for [2.11.0](https://github.com/Ocramius/PackageVersions/milestone/54)\n\nFeature release (minor)\n\n### 2.11.0\n\n- Total issues resolved: **0**\n- Total pull requests resolved: **4**\n- Total contributors: **2**\n\n#### dependencies,enhancement\n\n - [270: Add PHP 8.5 support](https://github.com/Ocramius/PackageVersions/pull/270) thanks to @samsonasik\n\n#### renovate\n\n - [269: Update dependency doctrine/coding-standard to v14](https://github.com/Ocramius/PackageVersions/pull/269) thanks to @renovate[bot]\n - [268: Update actions/checkout action to v5](https://github.com/Ocramius/PackageVersions/pull/268) thanks to @renovate[bot]\n - [266: Update dependency doctrine/coding-standard to v13](https://github.com/Ocramius/PackageVersions/pull/266) thanks to @renovate[bot]\n\n## 2.10.0 - 2025-02-05\n\n\n-----\n\n### Release Notes for [2.10.0](https://github.com/Ocramius/PackageVersions/milestone/52)\n\nFeature release (minor)\n\n### 2.10.0\n\n- Total issues resolved: **0**\n- Total pull requests resolved: **4**\n- Total contributors: **1**\n\n#### renovate\n\n - [261: Update dependency vimeo/psalm to v6](https://github.com/Ocramius/PackageVersions/pull/261) thanks to @renovate[bot]\n - [257: Roll back laminas/automatic-releases action to 1.24.0 - autoclosed](https://github.com/Ocramius/PackageVersions/pull/257) thanks to @renovate[bot]\n - [252: Update dependency phpunit/phpunit to v11](https://github.com/Ocramius/PackageVersions/pull/252) thanks to @renovate[bot]\n - [246: Update dependency phpunit/phpunit to v10 - abandoned](https://github.com/Ocramius/PackageVersions/pull/246) thanks to @renovate[bot]\n\n## 2.9.0 - 2024-08-04\n\n\n-----\n\n### Release Notes for [2.9.0](https://github.com/Ocramius/PackageVersions/milestone/50)\n\nFeature release (minor)\n\n### 2.9.0\n\n- Total issues resolved: **0**\n- Total pull requests resolved: **2**\n- Total contributors: **2**\n\n#### dependencies,enhancement\n\n - [256: Allow PHP 8.4](https://github.com/Ocramius/PackageVersions/pull/256) thanks to @fezfez\n\n#### security\n\n - [253: Update dependency composer/composer to ^2.7.0 &#91;SECURITY&#93;](https://github.com/Ocramius/PackageVersions/pull/253) thanks to @renovate[bot]\n\n## 2.8.0 - 2023-09-15\n\n\n-----\n\n### Release Notes for [2.8.0](https://github.com/Ocramius/PackageVersions/milestone/48)\n\nFeature release (minor)\n\n### 2.8.0\n\n- Total issues resolved: **0**\n- Total pull requests resolved: **4**\n- Total contributors: **2**\n\n#### enhancement\n\n - [250: Allow php 8.3](https://github.com/Ocramius/PackageVersions/pull/250) thanks to @fezfez\n\n#### renovate\n\n - [249: Update actions/checkout action to v4](https://github.com/Ocramius/PackageVersions/pull/249) thanks to @renovate[bot]\n - [245: Update dependency doctrine/coding-standard to v11](https://github.com/Ocramius/PackageVersions/pull/245) thanks to @renovate[bot]\n - [244: Update dependency vimeo/psalm to v5](https://github.com/Ocramius/PackageVersions/pull/244) thanks to @renovate[bot]\n\n## 2.7.0 - 2022-10-31\n\n\n-----\n\n### Release Notes for [2.7.0](https://github.com/Ocramius/PackageVersions/milestone/46)\n\nFeature release (minor)\n\n### 2.7.0\n\n- Total issues resolved: **0**\n- Total pull requests resolved: **6**\n- Total contributors: **2**\n\n#### dependencies\n\n - [243: Update dependency composer/composer to ^2.4.4](https://github.com/Ocramius/PackageVersions/pull/243) thanks to @Ocramius\n\n#### renovate\n\n - [242: Update all non-major dependencies, dropping PHP 8.0 support](https://github.com/Ocramius/PackageVersions/pull/242) thanks to @renovate[bot]\n - [240: Update dependency doctrine/coding-standard to v10](https://github.com/Ocramius/PackageVersions/pull/240) thanks to @renovate[bot]\n - [238: Configure Renovate](https://github.com/Ocramius/PackageVersions/pull/238) thanks to @renovate[bot]\n\n#### security\n\n - [239: Update dependency composer/composer to ^2.2.12 &#91;SECURITY&#93; - autoclosed](https://github.com/Ocramius/PackageVersions/pull/239) thanks to @renovate[bot]\n\n#### enhancement\n\n - [233: Streamlined CI setup with `laminas/laminas-ci-matrix-action`](https://github.com/Ocramius/PackageVersions/pull/233) thanks to @Ocramius\n\n## 2.3.0 - 2020-12-23\n\n\n-----\n\n### Release Notes for [2.3.0](https://github.com/Ocramius/PackageVersions/milestone/28)\n\n\n\n### 2.3.0\n\n- Total issues resolved: **0**\n- Total pull requests resolved: **1**\n- Total contributors: **1**\n\n#### enhancement\n\n - [164: Update `.gitattributes` to avoid exporting phpcs artifacts](https://github.com/Ocramius/PackageVersions/pull/164) thanks to @reedy\n\n## 1.10.1 - 2020-08-18\n\nIntroduced release automation tooling, which should also help us\nwith keeping the changelog up-to-date long-term.\n\n## 1.1.3 - 2017-09-06\n\nThis release fixes a bug that caused PackageVersions to prevent\nthe `composer remove` and `composer update` commands to fail when\nthis package is removed.\n\nIn addition to that, mutation testing has been added to the suite,\nensuring that the package is accurately and extensively tested.\n\nTotal issues resolved: **3**\n\n- [40: Mutation testing, PHP 7.1 testing](https://github.com/Ocramius/PackageVersions/pull/40) thanks to @Ocramius\n- [41: Removing this package on install results in file access error](https://github.com/Ocramius/PackageVersions/issues/41) thanks to @Xerkus\n- [46: #41 Avoid issues when the package is scheduled for removal](https://github.com/Ocramius/PackageVersions/pull/46) thanks to @Jean85\n\n## 1.1.2 - 2016-12-30\n\nThis release fixes a bug that caused PackageVersions to be enabled\neven when it was part of a globally installed package.\n\nTotal issues resolved: **3**\n\n- [35: remove all temp directories](https://github.com/Ocramius/PackageVersions/pull/35)\n- [38: Interferes with other projects when installed globally](https://github.com/Ocramius/PackageVersions/issues/38)\n- [39: Ignore the global plugin when updating local projects](https://github.com/Ocramius/PackageVersions/pull/39)\n\n## 1.1.1 - 2016-07-25\n\nThis release removes the [`\"files\"`](https://getcomposer.org/doc/04-schema.md#files) directive from\n[`composer.json`](https://github.com/Ocramius/PackageVersions/commit/86f2636f7c5e7b56fa035fa3826d5fcf80b6dc72),\nas it is no longer needed for `composer install --classmap-authoritative`.\nAlso, that directive was causing issues with HHVM installations, since\nPackageVersions is not compatible with it.\n\nTotal issues resolved: **1**\n\n- [34: Fatal error during travis build after update to 1.1.0](https://github.com/Ocramius/PackageVersions/issues/34)\n\n## 1.1.0 - 2016-07-22\n\nThis release introduces support for running `composer install --classmap-authoritative`\nand `composer install --no-scripts`. Please note that performance\nwhile using these modes may be degraded, but the package will\nstill work.\n\nAdditionally, the package was tuned to prevent the plugin from\nrunning twice at installation.\n\nTotal issues resolved: **10**\n\n- [18: Fails when using composer install --no-scripts](https://github.com/Ocramius/PackageVersions/issues/18)\n- [20: CS (spacing)](https://github.com/Ocramius/PackageVersions/pull/20)\n- [22: Document the way the require-dev section is treated](https://github.com/Ocramius/PackageVersions/issues/22)\n- [23: Underline that composer.lock is used as source of information](https://github.com/Ocramius/PackageVersions/pull/23)\n- [27: Fix incompatibility with --classmap-authoritative](https://github.com/Ocramius/PackageVersions/pull/27)\n- [29: mention optimize-autoloader composer.json config option in README](https://github.com/Ocramius/PackageVersions/pull/29)\n- [30: The version class is generated twice during composer update](https://github.com/Ocramius/PackageVersions/issues/30)\n- [31: Remove double registration of the event listeners](https://github.com/Ocramius/PackageVersions/pull/31)\n- [32: Update the usage of mock APIs to use the new API](https://github.com/Ocramius/PackageVersions/pull/32)\n- [33: Fix for #18 -  support running with --no-scripts flag](https://github.com/Ocramius/PackageVersions/pull/33)\n\n## 1.0.4 - 2016-04-23\n\nThis release includes a fix/workaround for composer/composer#5237,\nwhich causes `ocramius/package-versions` to sometimes generate a\n`Versions` class with malformed name (something like\n`Versions_composer_tmp0`) when running `composer require <package-name>`.\n\nTotal issues resolved: **2**\n\n- [16: Workaround for composer/composer#5237 - class parsing](https://github.com/Ocramius/PackageVersions/pull/16)\n- [17: Weird Class name being generated](https://github.com/Ocramius/PackageVersions/issues/17)\n\n## 1.0.3 - 2016-02-26\n\nThis release fixes an issue related to concurrent autoloader\nre-generation caused by multiple composer plugins being installed.\nThe issue was solved by removing autoloader re-generation from this\npackage, but it may still affect other packages.\n\nIt is now recommended that you run `composer dump-autoload --optimize`\nafter installation when using this particular package.\nPlease note that `composer (install|update) -o` is not sufficient\nto avoid autoload overhead when using this particular package.\n\nTotal issues resolved: **1**\n\n- [15: Remove autoload re-dump optimization](https://github.com/Ocramius/PackageVersions/pull/15)\n\n## 1.0.2 - 2016-02-24\n\nThis release fixes issues related to installing the component without\nany dev dependencies or with packages that don't have a source or dist\nreference, which is usual with packages defined directly in the\n`composer.json`.\n\nTotal issues resolved: **3**\n\n- [11: fix composer install --no-dev PHP7](https://github.com/Ocramius/PackageVersions/pull/11)\n- [12: Packages don't always have a source/reference](https://github.com/Ocramius/PackageVersions/issues/12)\n- [13: Fix #12 - support dist and missing package version references](https://github.com/Ocramius/PackageVersions/pull/13)\n\n## 1.0.1 - 2016-02-01\n\nThis release fixes an issue related with composer updates to\nalready installed versions.\nUsing `composer require` within a package that already used\n`ocramius/package-versions` caused the installation to be unable\nto write the `PackageVersions\\Versions` class to a file.\n\nTotal issues resolved: **6**\n\n- [2: remove unused use statement](https://github.com/Ocramius/PackageVersions/pull/2)\n- [3: Remove useless files from dist package](https://github.com/Ocramius/PackageVersions/pull/3)\n- [5: failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly](https://github.com/Ocramius/PackageVersions/issues/5)\n- [6: Fix/#5 use composer vendor dir](https://github.com/Ocramius/PackageVersions/pull/6)\n- [7: Hotfix - #5 generate package versions also when in phar context](https://github.com/Ocramius/PackageVersions/pull/7)\n- [8: Versions class should be ignored by VCS, as it is an install-time artifact](https://github.com/Ocramius/PackageVersions/pull/8)\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "---\ntitle: Contributing\n---\n\n# Contributing\n\n * Coding standard for the project is [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)\n * The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php)\n * Any contribution must provide tests for additional introduced conditions\n * Any un-confirmed issue needs a failing test case before being accepted\n * Pull requests must be sent from a new hotfix/feature branch, not from `master`.\n\n## Installation\n\nTo install the project and run the tests, you need to clone it first:\n\n```sh\n$ git clone git://github.com/Ocramius/PackageVersions.git\n```\n\nYou will then need to run a composer installation:\n\n```sh\n$ cd PackageVersions\n$ curl -s https://getcomposer.org/installer | php\n$ php composer.phar update\n```\n\n## Testing\n\nThe PHPUnit version to be used is the one installed as a dev- dependency via composer:\n\n```sh\n$ ./vendor/bin/phpunit\n```\n\nAccepted coverage for new contributions is 80%. Any contribution not satisfying this requirement \nwon't be merged.\n\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright (c) 2016 Marco Pivetta\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# Package Versions\n\n## A message to Russian 🇷🇺 people\n\nIf you currently live in Russia, please read [this message](./ToRussianPeople.md).\n\n### Purpose\n\nThis utility provides quick and easy access to version information of composer dependencies.\n\nThis information is derived from the ```composer.lock``` file which is (re)generated during ```composer install``` or ```composer update```.\n\n```php\n$version = \\PackageVersions\\Versions::getVersion('ocramius/package-versions');\n\nvar_dump($version); // 1.0.0@0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33\n```\n\n[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FOcramius%2FPackageVersions%2F2.0.x)](https://dashboard.stryker-mutator.io/reports/github.com/Ocramius/PackageVersions/2.0.x)\n[![Type Coverage](https://shepherd.dev/github/Ocramius/PackageVersions/coverage.svg)](https://shepherd.dev/github/Ocramius/PackageVersions)\n[![Downloads](https://img.shields.io/packagist/dt/ocramius/package-versions.svg)](https://packagist.org/packages/ocramius/package-versions)\n[![Packagist](https://img.shields.io/packagist/v/ocramius/package-versions.svg)](https://packagist.org/packages/ocramius/package-versions)\n[![Dependencies](https://tidelift.com/badges/github/packagist/ocramius%2Fpackage-versions)](https://tidelift.com/subscription/pkg/packagist-ocramius%2Fpackage-versions?utm_source=packagist-ocramius%2Fpackage-versions&utm_medium=readme)\n\n### Installation\n\n```sh\ncomposer require ocramius/package-versions\n```\n\nIt is suggested that you use [an optimized composer autoloader](https://getcomposer.org/doc/06-config.md#optimize-autoloader) (to prevent autoload I/O when accessing the `PackageVersions\\Versions` API) in your composer.json:\n\n```json\n...\n    \"config\": {\n        \"optimize-autoloader\": true\n    },\n...\n```\n\nIn case you manually generate your autoloader via the CLI use the `--optimize` flag:\n\n```sh\ncomposer dump-autoload --optimize\n```\n\n### Use-cases\n\nThis repository implements `PackageVersions\\Versions::getVersion()` in such a way that no IO\nhappens when calling it, because the list of package versions is compiled during composer\ninstallation.\n\nThis is especially useful when you want to generate assets/code/artifacts that are computed from\nthe current version of a certain dependency. Doing so at runtime by checking the installed\nversion of a package would be too expensive, and this package mitigates that.\n\n## ocramius/package-versions for enterprise\n\nAvailable as part of the Tidelift Subscription.\n\nThe maintainer of ocramius/package-versions and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-ocramius-package-versions?utm_source=packagist-ocramius-package-versions&utm_medium=referral&utm_campaign=enterprise&utm_term=repo).\n\nYou can also contact the maintainer at ocramius@gmail.com for looking into issues related to this package\nin your private projects.\n"
  },
  {
    "path": "SECURITY.md",
    "content": "## Security contact information\n\nTo report a security vulnerability, please use the\n[Tidelift security contact](https://tidelift.com/security).\nTidelift will coordinate the fix and disclosure.\n"
  },
  {
    "path": "ToRussianPeople.md",
    "content": "\n## 🇷🇺 Русским гражданам\n\nВ Украине сейчас идет война. Силами РФ наносятся удары по гражданской инфраструктуре в [Харькове][1], [Киеве][2], [Чернигове][3], [Сумах][4], [Ирпене][5] и десятках других городов. Гибнут люди - и гражданское население, и военные, в том числе российские призывники, которых бросили воевать. Чтобы лишить собственный народ доступа к информации, правительство РФ запретило называть войну войной, закрыло независимые СМИ и принимает сейчас ряд диктаторских законов. Эти законы призваны заткнуть рот всем, кто против войны. За обычный призыв к миру сейчас можно получить несколько лет тюрьмы.\n\nНе молчите! Молчание - знак вашего согласия с политикой российского правительства.  \n**Вы можете сделать выбор НЕ МОЛЧАТЬ.**\n\n---\n\n## 🇺🇸 To people of Russia\n\nThere is a war in Ukraine right now. The forces of the Russian Federation are attacking civilian infrastructure in [Kharkiv][1], [Kyiv][2], [Chernihiv][3], [Sumy][4], [Irpin][5] and dozens of other cities. People are dying – both civilians and military servicemen, including Russian conscripts who were thrown into the fighting. In order to deprive its own people of access to information, the government of the Russian Federation has forbidden calling a war a war, shut down independent media and is passing a number of dictatorial laws. These laws are meant to silence all those who are against war. You can be jailed for multiple years for simply calling for peace.\n\nDo not be silent! Silence is a sign that you accept the Russian government's policy.  \n**You can choose NOT TO BE SILENT.**\n\n[1]: <https://cloudfront-us-east-2.images.arcpublishing.com/reuters/P7K2MSZDGFMIJPDD7CI2GIROJI.jpg> \"Kharkiv under attack\"\n[2]: <https://gdb.voanews.com/01bd0000-0aff-0242-fad0-08d9fc92c5b3_cx0_cy5_cw0_w1023_r1_s.jpg> \"Kyiv under attack\"\n[3]: <https://ichef.bbci.co.uk/news/976/cpsprodpb/163DD/production/_123510119_hi074310744.jpg> \"Chernihiv under attack\"\n[4]: <https://www.youtube.com/watch?v=8K-bkqKKf2A> \"Sumy under attack\"\n[5]: <https://cloudfront-us-east-2.images.arcpublishing.com/reuters/K4MTMLEHTRKGFK3GSKAT4GR3NE.jpg> \"Irpin under attack\"\n"
  },
  {
    "path": "composer.json",
    "content": "{\n    \"name\": \"ocramius/package-versions\",\n    \"description\": \"Provides efficient querying for installed package versions (no runtime IO)\",\n    \"type\": \"library\",\n    \"license\": \"MIT\",\n    \"authors\": [\n        {\n            \"name\": \"Marco Pivetta\",\n            \"email\": \"ocramius@gmail.com\"\n        }\n    ],\n    \"require\": {\n        \"php\":                  \"~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0\",\n        \"composer-runtime-api\": \"^2.2.0\"\n    },\n    \"require-dev\": {\n        \"composer/composer\":                      \"^2.9.2\",\n        \"doctrine/coding-standard\":               \"^14.0.0\",\n        \"ext-zip\":                                \"^1.15.0\",\n        \"roave/infection-static-analysis-plugin\": \"^1.39.0\",\n        \"phpunit/phpunit\":                        \"^11.5.44\",\n        \"psalm/plugin-phpunit\":                   \"^0.19.5\",\n        \"vimeo/psalm\":                            \"^6.13.1\"\n    },\n    \"replace\": {\n        \"composer/package-versions-deprecated\": \"*\"\n    },\n    \"autoload\": {\n        \"psr-4\": {\n            \"PackageVersions\\\\\": \"src/PackageVersions\"\n        }\n    },\n    \"autoload-dev\": {\n        \"psr-4\": {\n            \"PackageVersionsTest\\\\\": \"test/PackageVersionsTest\"\n        }\n    },\n    \"config\": {\n        \"allow-plugins\": {\n            \"dealerdirect/phpcodesniffer-composer-installer\": true,\n            \"infection/extension-installer\": false\n        },\n        \"platform\": {\n            \"php\": \"8.2.99\"\n        }\n    }\n}\n"
  },
  {
    "path": "infection.json.dist",
    "content": "{\n    \"timeout\": 10,\n    \"source\": {\n        \"directories\": [\n            \"src\"\n        ]\n    },\n    \"logs\": {\n        \"text\": \"php://stderr\",\n        \"stryker\": {\n            \"report\": \"/^\\\\d\\\\.\\\\d\\\\.x$/\"\n        }\n    },\n    \"minMsi\": 100,\n    \"minCoveredMsi\": 100\n}\n"
  },
  {
    "path": "phpcs.xml.dist",
    "content": "<?xml version=\"1.0\"?>\n<ruleset>\n    <arg name=\"basepath\" value=\".\"/>\n    <arg name=\"extensions\" value=\"php\"/>\n    <arg name=\"parallel\" value=\"80\"/>\n    <arg name=\"cache\" value=\".phpcs-cache\"/>\n    <arg name=\"colors\"/>\n\n    <arg value=\"nps\"/>\n\n    <file>src</file>\n    <file>test</file>\n\n    <rule ref=\"Doctrine\"/>\n</ruleset>\n"
  },
  {
    "path": "phpunit.xml.dist",
    "content": "<?xml version=\"1.0\"?>\n<phpunit\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xsi:noNamespaceSchemaLocation=\"vendor/phpunit/phpunit/phpunit.xsd\"\n    bootstrap=\"./vendor/autoload.php\"\n    colors=\"true\"\n    columns=\"max\"\n    beStrictAboutChangesToGlobalState=\"true\"\n    beStrictAboutOutputDuringTests=\"true\"\n    failOnEmptyTestSuite=\"true\"\n    failOnDeprecation=\"true\"\n    failOnWarning=\"true\"\n    failOnPhpunitDeprecation=\"true\"\n    failOnNotice=\"true\"\n>\n    <testsuite name=\"PackageVersions tests\">\n        <directory>./test/PackageVersionsTest</directory>\n    </testsuite>\n\n    <source>\n        <include>\n            <directory>./src</directory>\n        </include>\n    </source>\n</phpunit>\n"
  },
  {
    "path": "psalm.xml",
    "content": "<?xml version=\"1.0\"?>\n<psalm\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xmlns=\"https://getpsalm.org/schema/config\"\n    xsi:schemaLocation=\"https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd\"\n    rememberPropertyAssignmentsAfterCall=\"false\"\n    errorLevel=\"1\"\n>\n    <plugins>\n        <pluginClass class=\"Psalm\\PhpUnitPlugin\\Plugin\"/>\n    </plugins>\n\n    <projectFiles>\n        <directory name=\"src\"/>\n        <directory name=\"test/PackageVersionsTest\"/>\n        <directory name=\"test/static-analysis/happy-path\"/>\n        <ignoreFiles>\n            <directory name=\"vendor\"/>\n        </ignoreFiles>\n    </projectFiles>\n</psalm>\n"
  },
  {
    "path": "renovate.json",
    "content": "{\n  \"$schema\": \"https://docs.renovatebot.com/renovate-schema.json\",\n  \"extends\": [\n    \"local>Ocramius/.github:renovate-config\"\n  ]\n}\n"
  },
  {
    "path": "src/PackageVersions/Versions.php",
    "content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace PackageVersions;\n\nuse Composer\\InstalledVersions;\nuse OutOfBoundsException;\n\nfinal class Versions\n{\n    /** @psalm-suppress UnusedConstructor */\n    private function __construct()\n    {\n    }\n\n    /**\n     * @psalm-pure\n     * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not\n     *                                  cause any side effects here.\n     */\n    public static function rootPackageName(): string\n    {\n        return InstalledVersions::getRootPackage()['name'];\n    }\n\n    /**\n     * @throws OutOfBoundsException if a version cannot be located.\n     *\n     * @psalm-pure\n     *\n     * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not\n     *                                  cause any side effects here.\n     * @psalm-suppress PossiblyNullOperand we know that {@see InstalledVersions} may return `null` values\n     */\n    public static function getVersion(string $packageName): string\n    {\n        return InstalledVersions::getPrettyVersion($packageName)\n            . '@' . InstalledVersions::getReference($packageName);\n    }\n}\n"
  },
  {
    "path": "test/PackageVersionsTest/VersionsTest.php",
    "content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace PackageVersionsTest;\n\nuse OutOfBoundsException;\nuse PackageVersions\\Versions;\nuse PHPUnit\\Framework\\Attributes\\CoversClass;\nuse PHPUnit\\Framework\\Attributes\\Group;\nuse PHPUnit\\Framework\\TestCase;\n\nuse function array_merge;\nuse function assert;\nuse function file_get_contents;\nuse function is_string;\nuse function json_decode;\nuse function uniqid;\n\nuse const JSON_THROW_ON_ERROR;\n\n#[CoversClass(Versions::class)]\nfinal class VersionsTest extends TestCase\n{\n    public function testValidVersions(): void\n    {\n        $contents = file_get_contents(__DIR__ . '/../../composer.lock');\n\n        assert(is_string($contents));\n\n        /**\n         * @var array{\n         *     packages: array<string, array{\n         *         name: string,\n         *         version: string,\n         *         source: array{\n         *             reference: string\n         *         }\n         *     }>,\n         *     packages-dev: array<string, array{\n         *         name: string,\n         *         version: string,\n         *         source: array{\n         *             reference: string\n         *         }\n         *     }>,\n         * } $lockData\n         */\n        $lockData = json_decode($contents, true, flags: JSON_THROW_ON_ERROR);\n\n        $packages = array_merge($lockData['packages'], $lockData['packages-dev']);\n\n        self::assertNotEmpty($packages);\n\n        foreach ($packages as $package) {\n            self::assertSame(\n                $package['version'] . '@' . $package['source']['reference'],\n                Versions::getVersion($package['name']),\n            );\n        }\n    }\n\n    #[Group('#148')]\n    public function testCanRetrieveRootPackageVersion(): void\n    {\n        /** @psalm-suppress DeprecatedConstant */\n        self::assertMatchesRegularExpression('/^.+\\@[0-9a-f]+$/', Versions::getVersion(Versions::rootPackageName()));\n    }\n\n    #[Group('#153')]\n    public function testCanRetrieveRootPackageName(): void\n    {\n        self::assertMatchesRegularExpression('/^[a-z0-9\\\\-]+\\\\/[a-z0-9\\\\-]+$/', Versions::rootPackageName());\n    }\n\n    public function testInvalidVersionsAreRejected(): void\n    {\n        $this->expectException(OutOfBoundsException::class);\n\n        /** @psalm-suppress ArgumentTypeCoercion we are explicitly testing for something not allowed by the type system */\n        Versions::getVersion(uniqid('', true) . '/' . uniqid('', true));\n    }\n}\n"
  },
  {
    "path": "test/static-analysis/happy-path/expected-package-name.php",
    "content": "<?php\n\ndeclare(strict_types=1);\n\nuse PackageVersions\\Versions;\n\n/** @psalm-pure */\nfunction getVersion(): string\n{\n    return Versions::getVersion('ocramius/package-versions');\n}\n"
  },
  {
    "path": "test/static-analysis/unhappy-path/unexpected-package-name.php",
    "content": "<?php\n\ndeclare(strict_types=1);\n\nuse PackageVersions\\Versions;\n\nreturn Versions::getVersion('');\n"
  }
]