A VSCode extension to remove unused imports in PHP files automatically.
Features
Automatically detect unused use statements in PHP files
Supports both single use statements and grouped use statements
Keyboard shortcut for quick operation: Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)
User-friendly messages after operation completion
PHP file specific to avoid accidental changes to other file types
Requirements
No external dependencies required. Works with any PHP file in VSCode.
Usage
Open a PHP file in VSCode
Press Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)
The extension will automatically remove all unused use statements
Example
Before:
<?php
use App\Models\User;
use App\Models\Post;
use App\Models\Comment;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class TestClass
{
public function testMethod()
{
$user = new User();
$data = DB::table('users')->get();
return $user;
}
}
After:
<?php
use App\Models\User;
use Illuminate\Support\Facades\DB;
class TestClass
{
public function testMethod()
{
$user = new User();
$data = DB::table('users')->get();
return $user;
}
}
Extension Settings
This extension currently has no configurable settings.