Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>copy-php-classNew to Visual Studio Code? Get it now.
copy-php-class

copy-php-class

macive

|
10 installs
| (0) | Free
copies the php class by concating the class name and the namespace, Copies namespace and class name to clipboard
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

copy-php-class

Copy 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

  • Copy Fully Qualified Class Name: Right-click within a PHP file, select "Copy Namespace and Class Name," and have the namespace and class concatenated and copied to your clipboard.
  • Context Menu Integration: Available directly in the editor's context menu when working with PHP files.
  • Simple and Fast: No configuration needed—just install and use!

Example

Imagine you have the following PHP code:

<?php
namespace App\Services;

class UserService {
    // Class content
}

Right-click anywhere in the file, select Copy Namespace and Class Name, and App\\Services\\UserService will be copied to your clipboard, ready to paste wherever you need it.

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!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft