copy-php-classCopy PHP Class is a lightweight Visual Studio Code extension designed to streamline your PHP development workflow. With a single command, it copies the fully qualified class name (namespace + class name) of a PHP class to your clipboard, making it easier to reference classes across your project. This extension is perfect for PHP developers who frequently work with namespaces and need a quick way to access class identifiers. Features
ExampleImagine you have the following PHP code:
Right-click anywhere in the file, select Copy Namespace and Class Name, and Tip: For a quick demo, check out this short animation: Requirements Visual Studio Code: Version 1.97.0 or higher. PHP Files: The extension activates only for files with the php language identifier. No additional dependencies or setup is required—just install the extension and start using it! How to Use Open a PHP file in Visual Studio Code. Right-click anywhere in the editor. Select Copy Namespace and Class Name from the context menu. The fully qualified class name (e.g., Namespace\ClassName) is now in your clipboard—paste it wherever you need! Alternatively, trigger the command manually: Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on macOS). Type and select Copy Namespace and Class Name. Extension Settings This extension does not currently contribute any settings via contributes.configuration. It works out of the box with no customization required. Let us know in the issues section if you'd like to see configurable options! Known Issues Class Detection: The extension assumes the namespace and class are properly defined in the file. If your PHP file lacks a namespace or class declaration, the command may not copy the expected result. Multiple Classes: If a file contains multiple classes, only the first detected class name will be used. Feel free to report any bugs or suggestions in the GitHub Issues section! |