{"id":15062730,"url":"https://github.com/macfja/composer-phar-bin","last_synced_at":"2026-01-03T01:06:17.736Z","repository":{"id":62521324,"uuid":"253323738","full_name":"MacFJA/composer-phar-bin","owner":"MacFJA","description":"Composer plugin to replace dev dependencies by Phar","archived":false,"fork":false,"pushed_at":"2020-05-01T14:40:27.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-22T04:33:19.327Z","etag":null,"topics":["composer-plugin","phar","phive"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MacFJA.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-05T20:16:14.000Z","updated_at":"2020-05-01T14:39:36.000Z","dependencies_parsed_at":"2022-11-02T10:32:07.002Z","dependency_job_id":null,"html_url":"https://github.com/MacFJA/composer-phar-bin","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacFJA%2Fcomposer-phar-bin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacFJA%2Fcomposer-phar-bin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacFJA%2Fcomposer-phar-bin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacFJA%2Fcomposer-phar-bin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MacFJA","download_url":"https://codeload.github.com/MacFJA/composer-phar-bin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243741280,"owners_count":20340438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composer-plugin","phar","phive"],"created_at":"2024-09-24T23:45:21.903Z","updated_at":"2026-01-03T01:06:17.687Z","avatar_url":"https://github.com/MacFJA.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Composer Phar Bin plugin\n\nThe plugin replace development dependencies by their Phar.\n\n## Why ?\n\nI encounter several times a dependency lock on dev tool (code quality, documentation generation, etc.), and most of the time those tool have a Phar binary.\n\nTo manage those Phar, solution already exist, like [Phive](https://phar.io/), but it's an another tool to install, another set of commands to run.\n\nSo, I create this Composer plugin to integrate Phive into Composer in the less visible way.\n\n## How it's works ?\n\nWhen run `composer install`, `composer update`, or `composer require`, the plugin will check if any of your _`require-dev`_ packages exist in the Phive repository.\nIf found then Phive will link the Phar in your composer binaries so scripts will continue to work and the dependency will be ignore (so its sub-dependencies).\n\n## Installation\n\nSimply run: `composer require macfja/composer-phar-bin`, and then a `composer install`.  \nOr globally: `composer global require macfja/composer-phar-bin`.\n\nAny later `composer install`, `composer update`, or `composer require` will trigger the dependencies replacement.\n\n## How prevent a package to be replace ?\n\nIf for some reason need a package known by Phive to not be replace by its Phar, you can add in you (root) `composer.json` a list of package to don't replace.\n\nIn the `extra` section add `composer-phar-bin` object that contains an array named `exclude` of Composer packages.\n\n### Example\n\nIn the following example, `phpunit/phpunit` will be downloaded and managed by Composer, but `phan/phan` will be replace by its Phar.\n\n```json\n{\n    \"name\": \"macfja/composer-phar-bin-test\",\n    \"require-dev\": {\n        \"macfja/composer-phar-bin\": \"^1.0.0\",\n        \"phpunit/phpunit\": \"^9.1\",\n        \"phan/phan\": \"^2.7\"\n    },\n    \"extra\": {\n        \"composer-phar-bin\": {\n            \"exclude\": [\"phpunit/phpunit\"]\n        }\n    }\n}\n```\n\n## Limitation\n\nThe plugin only work after been installed. That seem obvious but there are cases which are tedious to understand because of this.\n\n### Dependencies conflicts on new a environment\n\nLet's imagine that you use the plugin and you have _virtually_ some conflict.\nEverything work fine, the plugin replace conflicting libraries with their Phar.\n\nSomeone want to install the project, but Composer complaint about some packages (\"Your requirements could not be resolved to an installable set of packages.\").\n\nThe reason is probably because you don't commit your `composer.lock` file, so Composer is trying to solve all dependencies, and as our plugin is not yet installed and loaded, it can't do its magic.\n\n#### How to solve this ?\n\nYou have several solutions to solve this:\n- you can commit your `composer.lock` file\n- you can generate it gradually: remove all dev dependencies, then install your project (`composer install`), and now readd all you dev dependencies\n- you can install the plugin globally (so it will always be loaded)\n\n### Missing phars on fresh install\n\nYou download a project with a `composer.lock`, run `composer install`.\n\nEverything seem ok, but when you first run a composer script, Composer complain about missing file.\n\nThe issue here is that the Composer read the `composer.lock` file, and so only install your dependencies, excluding the ones that are manage by our plugin.\nBut as the plugin is not loaded (because not yet installed) it doesn't install phar.\n\n#### How to solve this ?\n\nYou have two options:\n- simply rerun `composer install`\n- install the plugin globally (so it will always be loaded)\n\n## Contributing\n\nYou can contribute to the library.\nTo do so, you have Github issues to:\n\n - ask your question\n - request any change (typo, bad code, etc.)\n - and much more...\n\nYou also have PR to:\n\n - suggest a correction\n - and much more... \n\n### Local installation\n\nFirst clone the project (either this repository, or your fork),\nnext run:\n\n```shell script\nmake install # Install project vendor\nmake all # Run QA tools + generate docs\n```\n\n### Validate your code\n\nWhen you done writing your code run the following command check if the quality meet defined rule and to format it:\n\n```shell script\nmake analyze # Run QA tools\n```\n\n\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacfja%2Fcomposer-phar-bin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacfja%2Fcomposer-phar-bin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacfja%2Fcomposer-phar-bin/lists"}