Rename a plugin to a new author and name

Use it to give a plugin a new author or name, with every namespace, table, code and path renamed, and a command that carries existing data across when sites already have it installed.

  • Tested with Opus 5.5
  • October CMS 4.x
  • Plugins & Extending
  • By the October CMS team
  • Updated on Nov 21, 2026
Prompt
You are helping me rename a plugin for October CMS 4, which runs on Laravel. Rename from: [Old.Plugin, eg: Acme.Library] Rename to: [New.Plugin, eg: Initech.Catalog] Keep existing data: [yes or no] Rename the plugin everywhere its author or name is written, and change nothing else about how it works. The examples below rename Acme.Library to Initech.Catalog. 1. Move the plugin to its new folder in lowercase, eg: plugins/initech/catalog, unless it is already there. Do this together with the namespace, because October CMS stops with a "Cannot redeclare class" error while the two disagree. 2. Replace the old name in every file of the plugin: PHP, YAML, views, mail templates, JavaScript, CSS, composer.json and the migrations. It is written in five forms: - Acme\Library is the PHP namespace, also where a class name is written as a string. - Acme.Library is the plugin code, eg: in BackendMenu::setContext and $require. - acme.library is in language, view, mail and config codes such as acme.library::lang.title, and in permission codes and event names. - acme/library is in asset URLs, backend URLs, YAML paths starting with ~ or $, and the composer package name. - acme_library is in table names, settings codes, validation rules and raw queries. 3. Change the table names inside the existing migrations as well, so a new install creates its tables under the new name. Keep the migration files, their order and their columns as they are. 4. Search the rest of the project for the same five forms and update them: themes, other plugins that require or extend this one, and overrides in the config and lang folders. 5. Search once more for the old author and the old name on their own, in any letter case. List each one you left and why. If I am keeping existing data, a site that has the old plugin still holds everything under the old name, and October CMS will treat the renamed plugin as a new one and create empty tables for it. So add a console command to the plugin, eg: catalog:move-data, that moves a site to the new name and moves it back with --rollback. The command: - Checks everything before it changes anything, and stops if a check fails. Where the new tables already exist they must be empty: it drops them and deletes the new plugin's rows from system_plugin_versions and system_plugin_history. - Renames each table to the new name, along with its indexes, which otherwise keep the old name. - Changes the plugin code in system_plugin_versions and system_plugin_history, so October CMS sees the new plugin as installed at the same version and does not run its migrations again. - Updates what other tables store about the plugin, skipping tables that do not exist: system_settings.item, system_mail_templates.code, permission codes in backend_user_roles.permissions and backend_users.permissions, backend_user_preferences.namespace, and columns that hold a model class name, such as system_files.attachment_type, system_revisions.revisionable_type, deferred_bindings and the translation tables. - Asks me to confirm unless I pass --force, does nothing when run a second time, and reports what it changed. Do not rename models, controllers, components, component aliases or columns. Do not fix other problems you notice, list them at the end instead. Do not write to the database yourself. Finish with a table of everything renamed that a theme, another plugin or stored data could refer to, with the old name beside the new one, then the commands I need to run, in order.
How to use

Fill in the old and new plugin codes, eg: Acme.Library and Initech.Catalog, then paste it into an AI assistant that can edit the files in your project. The author, the name or both can change.

Answer yes to keeping existing data when any site has the old plugin installed with records worth keeping. The assistant then writes a console command that you run once on each site. Answer no for a plugin still in development, where every site can start with empty tables. The old tables and version rows stay behind on a site that had the old plugin.

Before you start:

  • Commit your work, so the rename is one change you can review and undo.
  • Leave the folder where it is. If you move it yourself, every artisan command stops with "Cannot redeclare class" until the namespace matches.
  • Use this on a plugin you develop in the project. A plugin installed with Composer comes back under its old name on the next update.

Check these in the result:

  • php artisan plugin:list runs and shows the new code.
  • A search of the plugin for the old author, ignoring letter case, finds only what the assistant listed as kept.
  • The model's $table, the migrations, unique: validation rules and raw queries all use the new table prefix, eg: initech_catalog_books.
  • The backend pages load their CSS and JavaScript, and the menu item is highlighted.
  • The mail template code in Plugin.php is the one passed to Mail::send.

With existing data, try the command on a copy of the database first:

  • After php artisan catalog:move-data, plugin:list shows the new plugin at the version the old one had, and php artisan october:migrate has nothing to run for it.
  • Uploaded files still appear on their records, and roles keep their permissions.
  • php artisan catalog:move-data --rollback puts every table and code back.

Good follow-up prompts:

  • "Fire the old event names beside the new ones, so other plugins keep working."
  • "Update this theme using the table of renamed codes."

Was this prompt helpful?

Still need help?
October Forum

Community members share experiences, ask questions and exchange tips.

Discord

Talk with other October CMS developers in real time.

Custom Development

Hire the October CMS team to work on your website.

Contact Us

For bug reports and help with this website. See the roadmap or submit an idea on the Portal.