PhpStorm
 
Get PhpStorm

Extract class

Last modified: 16 August 2024

PhpStorm lets you use refactorings that extract class methods and properties into a new class. These refactorings are useful when a class has grown too large and "does too many things". In such cases, it may be a good idea to split the class into smaller, more cohesive classes. Additionally, you can extract functions defined in php files into new classes. This may be useful for grouping related functionality into utility classes, avoiding collisions for non-namespaced methods, or representing your codebase in an object-oriented manner.