{"id":15096857,"url":"https://github.com/xwp/composer-isolator","last_synced_at":"2025-10-08T00:32:14.699Z","repository":{"id":52104028,"uuid":"365176910","full_name":"xwp/composer-isolator","owner":"xwp","description":"Composer plugin to isolate project dependencies by prefixing their namespace","archived":false,"fork":true,"pushed_at":"2021-05-26T17:02:40.000Z","size":53,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-01T14:40:09.374Z","etag":null,"topics":["composer","composer-package","composer-plugin","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"logical-and/composer-isolation","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xwp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-07T09:08:28.000Z","updated_at":"2023-04-30T14:35:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/xwp/composer-isolator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwp%2Fcomposer-isolator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwp%2Fcomposer-isolator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwp%2Fcomposer-isolator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwp%2Fcomposer-isolator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xwp","download_url":"https://codeload.github.com/xwp/composer-isolator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235669382,"owners_count":19026815,"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","composer-package","composer-plugin","wordpress"],"created_at":"2024-09-25T16:01:57.814Z","updated_at":"2025-10-08T00:32:09.420Z","avatar_url":"https://github.com/xwp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Composer Isolator\n\n[![Lint and Test](https://github.com/xwp/composer-isolation/actions/workflows/ci.yml/badge.svg)](https://github.com/xwp/composer-isolation/actions/workflows/ci.yml)\n\n**Composer plugin to isolate project dependencies by prefixing their namespace.**\n\n---\n\n## How it Works\n\nThis plugin prefixes all vendor namespaces with a chosen value. This \nincludes all declared namespaces, use statements, fully qualified \nreferences, and most string values that reference the namespace.  \n\nAll vendor code and composer autoload mappings are updated to reference \nthe prefixed namespace.  \n\n### What it does _not_ do\n\nIt will not touch any code in your project. It only affects code in the \nvendor directory, and it only affects code referencing the affected \nnamespaces. You must update all references in your code yourself if you \napply this to an existing project.  \n\n### Why use it\n\nThis plugin allows you to run two projects that utilize composer \ndependencies in the same runtime, without worrying about conflicting \ndependencies. The most common example is in a WordPress environment, \nwhere all plugins execute in the same runtime, and may rely on the same \ncomposer dependencies. Each project utilizing the plugin can't conflict \nwith any other project unless the vendor code is not namespaced (in which \ncase there aren't many options...).\n\n## Known Limitations\n\n- It doesn't replace function definitions and calls in the global namespace. Any definitions and calls to global functions will remain in the global namespace after the transformation.\n\n## Usage  \n\nUsing the plugin is straightforward. Install the plugin by requiring it \nin your project: `composer require and/isolate-composer`.\n\nConfigure the plugin by adding the following to your `composer.json`: \n```\n\"config\" : {\n    \"isolate\": {\n      \"prefix\": \"Your\\\\Prefix\\\\Here\\\\\",\n      \"excludelist\": [],\n      \"autorun\": false,\n      \"require-dev\": false,\n      \"replacements\" : {}\n    }\n}\n```\n\nThe only required value is the `prefix`.  \n\nAfter you have configured the plugin, run the isolation:\n```\ncomposer isolate\ncomposer dump\n```\n\nYour vendor code is now prefixed!  \n\nBe sure to `dump` after you `isolate`, or your autoload mappings will \nbe incorrect! \n\n## Configuration  \n\n**prefix**  \n\nThis is the value that will be prepended to all vendor namespaces. It \nshould be a valid namespace, and should be unique to your project. I \nrecommend you don't use your main project namespace, or at least add \n`\\\\Vendor` to the end.  \n\n**exludelist**  \n\nThis is a list of packages you don't want to prefix. Matching packages \nwill not be scanned for namespaces, but will still have code rewritten \nif it contains namespaces from other non-excluded packages.  \n\n**autorun**  \n\nSetting this value to true automatically runs the isolation process \nbefore every `dump`. \n\n**require-dev**  \n\nBy default, only `require` packages are scanned for namespaces, and \n`require-dev` packages are ignored (as above, they will still have code \nrewritten if they contain namespaces from other packages).  \n\nSetting this value to `true` includes the `require-dev` packages in the \nscan, and any found namespaces will be prefixed.  \n\n**replacements**  \n\nThis is a place for manually fixing things in the vendor code that either \nwere not detected and replaced, or replaced when they should not have been.   \n\nAfter each file has been parsed and rewritten, if there is an entry in the \nreplacements list, it will do a string replace on the file.  \n\nString replacements should be idempotent, or things will break on multiple \nexecutions.  \n\nThe syntax is: \n``` \n\"replacements\" : {\n    \"path/relative/to/vendor/root/file.php\" : {\n        \"search\" : \"replace\",\n        \"search\" : \"replace\",\n    },\n    \"path/relative/to/vendor/root/file.php\" : {\n            \"search\" : \"replace\",\n            \"search\" : \"replace\",\n        }\n}\n```\n\n## Credits\n\nCreated and maintaned by [XWP](https://xwp.co) as a fork of [and/composer-isolation](https://github.com/logical-and/composer-isolation).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxwp%2Fcomposer-isolator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxwp%2Fcomposer-isolator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxwp%2Fcomposer-isolator/lists"}