PHPackages                             phpactor/class-mover - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. phpactor/class-mover

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

phpactor/class-mover
====================

Library for moving classes

0.2.0(4y ago)448.7k↑80%2[2 PRs](https://github.com/phpactor/class-mover/pulls)1MITPHPPHP ^7.3 || ^8.0

Since Aug 26Pushed 4y ago1 watchersCompare

[ Source](https://github.com/phpactor/class-mover)[ Packagist](https://packagist.org/packages/phpactor/class-mover)[ RSS](/packages/phpactor-class-mover/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (14)Versions (17)Used By (1)

Class Mover
===========

[](#class-mover)

[![CI](https://github.com/phpactor/class-mover/workflows/CI/badge.svg)](https://github.com/phpactor/class-mover/workflows/CI/badge.svg)[![StyleCI](https://camo.githubusercontent.com/9a03dc286657bd27bcca913e10d348cbda498cc7883fafd46c637ed6c0bf395b/68747470733a2f2f7374796c6563692e696f2f7265706f732f2533437265706f2d69642533452f736869656c64)](https://styleci.io/repos/%3Crepo-id%3E)

This is a library dedicated to refactoring class locations.

It takes care of:

- **Finding references to a class**: Find all references to a class (or classes).
- **Finding references to class methods**: Find references to a class method, or all method calls on a class, or all method calls ever.
- **Replacing references to the class**: Update any references in the code (using a given method, e.g. all under a path or all files in the git repo).
- **Modifying use statements**: update any use statements for the replaced class.
- **Adding use cases**: where necessary.

Why?
----

[](#why)

When using an editor such as VIM, one of the biggest issues I face is moving classes and replacing their references - it is such a big issue for me that I rarely do it.

Current approaches involve git moving the class, then running a for loop in bash over a set of files and applying perl replace to them, piping the output of that to a temporary file and then moving that temporary file to overwrite the old one. And that doesn't always work well.

This package aims to provide a solid way of doing this, and can, for example, be packaged in an

Usage
-----

[](#usage)

```
$targetClass = 'Acme\Blog\Post';
$replacementClass = 'Acme\Blog\Article';
$sourceCode = file_get_contents('SomeSource.php');

$classMover = new ClassMover();

$source = $classMover->replaceReferences(
    $classMover->findReferences($sourceCode, $targetClass)
    $replacementClass
);

echo (string) $source;
```

Contributing
------------

[](#contributing)

This package is open source and welcomes contributions! Feel free to open a pull request on this repository.

Support
-------

[](#support)

- Create an issue on the main [Phpactor](https://github.com/phpactor/phpactor) repository.
- Join the `#phpactor` channel on the Slack [Symfony Devs](https://symfony.com/slack-invite) channel.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 99.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~206 days

Recently: every ~214 days

Total

6

Last Release

1602d ago

PHP version history (2 changes)0.1.0PHP ^7.1

0.1.4PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/24ec7d5d6b7ea54007be5d7b4f43800381cc1e22929f7d2276fba30e497fdfa6?d=identicon)[dantleech](/maintainers/dantleech)

---

Top Contributors

[![dantleech](https://avatars.githubusercontent.com/u/530801?v=4)](https://github.com/dantleech "dantleech (156 commits)")[![gquemener](https://avatars.githubusercontent.com/u/668604?v=4)](https://github.com/gquemener "gquemener (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phpactor-class-mover/health.svg)

```
[![Health](https://phpackages.com/badges/phpactor-class-mover/health.svg)](https://phpackages.com/packages/phpactor-class-mover)
```

###  Alternatives

[phpro/soap-client

A general purpose SoapClient library

8885.6M46](/packages/phpro-soap-client)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[sensiolabs/minify-bundle

Assets Minifier (CSS, JS) for Symfony &amp; Minify integration in Asset Mapper

5694.9k1](/packages/sensiolabs-minify-bundle)[phpactor/class-to-file

Library to covert class names to file paths and vice-versa

11527.7k6](/packages/phpactor-class-to-file)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
