{"id":22338952,"url":"https://github.com/interfacelab/namespacer","last_synced_at":"2025-07-30T00:31:07.808Z","repository":{"id":43806222,"uuid":"290245312","full_name":"Interfacelab/namespacer","owner":"Interfacelab","description":"Namespacer allows you to re-namespace any composer packages you are using by adding a namespace prefix to all of the  namespaces as well as prefixing the package names too.  It will then generate a folder called \"lib\" which you can safely include in your WordPress plugin.","archived":false,"fork":false,"pushed_at":"2023-10-04T13:41:51.000Z","size":15,"stargazers_count":29,"open_issues_count":3,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-26T01:26:37.288Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Interfacelab.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":"2020-08-25T15:00:01.000Z","updated_at":"2024-10-21T23:21:47.000Z","dependencies_parsed_at":"2022-09-14T07:02:01.610Z","dependency_job_id":null,"html_url":"https://github.com/Interfacelab/namespacer","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Interfacelab/namespacer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Interfacelab%2Fnamespacer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Interfacelab%2Fnamespacer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Interfacelab%2Fnamespacer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Interfacelab%2Fnamespacer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Interfacelab","download_url":"https://codeload.github.com/Interfacelab/namespacer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Interfacelab%2Fnamespacer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267785725,"owners_count":24144118,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-12-04T07:06:12.400Z","updated_at":"2025-07-30T00:31:07.487Z","avatar_url":"https://github.com/Interfacelab.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Namespacer\nUsing composer when building WordPress plugins sound like a good idea at first, but it won't be long until you run into \ntrouble when other plugins are loading incompatible versions of libraries that you are using.  Our plugin, \n[MediaCloud](https://mediacloud.press), uses packages extensively - over 65 different libraries - many of them fairly \ncommon.  I'd say over half of our support requests are due to conflicts with other plugins users have installed that \nare using outdated or newer versions of the same libraries we are using.  The only way to really do that is to \nre-namespace the packages we are using and to be able to do that easily and safely.\n\nNamespacer allows you to re-namespace any composer packages you are using by adding a namespace prefix to all of the \nnamespaces as well as prefixing the package names too.  It will then generate a folder called \"lib\" which you can safely\ninclude in your plugin.\n\nYes, I'm aware of projects out there like PHP-Scoper and Imposter and others.  I've had issues with all of them, which \nis why I built this.  Yoast and other plugins happily used PHP-Scoper, but their plugins, believe it or not, are much\nsmaller than [MediaCloud](https://mediacloud.press).  Yoast, for example, uses 4 composer packages.\n\n## Installation\nYou can install this globally, but I think you'd be better off using it as the basis of a project via composer.\n\n```bash\ncomposer require ilab/namespacer\n```\n\n## Usage\nOnce installed:\n\n```bash\n./vendor/bin/renamespace [--composer COMPOSER] [--source SOURCE] [--package PACKAGE] [--namespace NAMESPACE] [--config CONFIG] \u003cdest\u003e\n```\n\n### Arguments\n| Argument    | Description |\n| ----------- | ----------- |\n| `composer`  | The path (full or relative) to the composer file containing all the package dependencies you want to renamespace.  You must specify this argument OR the `source` argument. |\n| `source`    | The path (full or relative) to a directory containing a composer file and an existing vendor directory.  When using `source` the vendor directory must already exist (`composer update` must already have been run).  You must specify this argument OR the `composer` argument. |\n| `package`   | The prefix to append to package names, for example specifying `--package mcloud` will turn `nesbot/carbon` into `mcloud-nesbot/carbon`. Default is `mcloud`. |\n| `namespace` | The prefix to append to namespaces, for example specifying `--namespace MediaCloud\\Vendor` will transform `namespace Aws;` into `namespace MediaCloud\\Vendor\\Aws;`. Default is `MediaClound\\Vendor`. |\n| `config`    | An optional PHP configuration file for inserting filters into the namespacing process. |\n| `\u003cdest\u003e`    | The destination directory.  Namespacer will create a directory named `lib` inside that directory, removing it first if it already exists. |\n\nFor example, you might run it:\n\n```bash\n./vendor/bin/namespacer --composer sample.composer.json --config patches.config.php --package mypackage --namespace MyNamespace\\Vendor build/\n```\n\nIn this example, we're pointing to a `composer.json` file containing the packages we want to re-namespace and to a \nconfig file that contains filters that will apply more manual patches during the re-namespace process.  The output \nof the processing will be put into the `build/` folder.\n\n### Filtering (Patching in PHP-Scoper parlance)\nYou can see some example configurations in `vendor/ilab/namespacer/sample.config.php` and \n`vendor/ilab/namespacer/patches.config.php` that will demonstrate how to insert your own code into the namespacing\nprocess to catch special cases. \n\n## Reporting Bugs\nIf you run into issues, please open a ticket and attach the composer.json you were trying to process with a clear\ndescription of the problem.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterfacelab%2Fnamespacer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterfacelab%2Fnamespacer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterfacelab%2Fnamespacer/lists"}