zemmelmootez/phplocator

Click-to-code for PHP: automatic source mapping for browser extensions like LocatorJS

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 0

Forks: 0

Open Issues: 0

Language:HTML

pkg:composer/zemmelmootez/phplocator

v1.1.0 2025-08-28 16:51 UTC

This package is auto-updated.

Last update: 2026-01-06 15:42:24 UTC


README

Instantly jump from browser elements to your PHP source code

Packagist Version GitHub Stars License Downloads

🌐 Live Website & Demo

What is PHP Locator?

PHP Locator brings click-to-code functionality to PHP development. Inspired by LocatorJS, it allows you to Alt+Click any element in your browser and instantly jump to the exact source code line in VS Code.

Key Benefits:

  • Zero Configuration - Install and it works automatically
  • Universal Compatibility - Works with any PHP project or framework
  • Instant Navigation - Jump directly to source code in seconds
  • Visual Feedback - Clear indicators show clickable elements
  • Professional Workflow - Streamlines debugging and development

Installation

Step 1: Browser Extension

Chrome/Edge/Brave/Opera:

Manual Installation:

  1. Download the latest release
  2. Extract the ZIP file
  3. Open chrome://extensions/
  4. Enable "Developer mode"
  5. Click "Load unpacked" → Select the extension folder

Step 2: PHP Package

Option A: Composer (Recommended)

composer require zemmelmootez/phplocator

The package auto-loads and starts working immediately - no additional setup required.

Option B: Manual Installation

git clone https://github.com/zemmelmootez/phplocator.git
<?php
require_once 'path/to/phplocator.php';
// Now ready to use
?>

Usage

The Simple Process:

  1. Hold Alt key
  2. Hover over any HTML element (highlights appear)
  3. Click the element → VS Code opens to the exact line

Framework Examples:

Vanilla PHP:

<?php
// Composer auto-loads PHP Locator
?>
<!DOCTYPE html>
<html>
<body>
    <h1>Welcome</h1> <!-- Alt+Click opens this line in VS Code -->
    <p>Content here</p>
</body>
</html>

Laravel Blade:

@extends('layouts.app')
@section('content')
    <div class="container">
        <h1>{{ $title }}</h1> {{-- Alt+Click opens this Blade file --}}
    </div>
@endsection

WordPress:

<?php
// In your theme's functions.php - Composer auto-loads
?>
<div class="post-content">
    <h2><?php the_title(); ?></h2> <!-- Alt+Click opens this template -->
</div>

Advanced Configuration

Manual Data Attributes

For custom implementations:

<div data-php-file="<?php echo __FILE__; ?>" data-php-line="<?php echo __LINE__; ?>">
    Custom tracked element
</div>

Troubleshooting

Extension not working?

  • ✅ Extension installed and enabled
  • ✅ Developer mode enabled in browser
  • ✅ VS Code installed with URL handler
  • ✅ PHP package installed via Composer

No highlights appearing?

  • Check HTML source for: <!-- PHP Locator: Tracking file: ... -->
  • Verify Composer autoload is working
  • Check browser console for errors

VS Code not opening?

  • Ensure VS Code is properly installed
  • Try: code --install-extension to register URL handler
  • Test with different browsers

Technical Details

How It Works:

  1. PHP Locator automatically injects source mapping data attributes
  2. Browser extension detects these attributes
  3. Alt+Click triggers VS Code protocol handler
  4. VS Code opens the exact file and line number

Supported Environments:

  • PHP: 7.4+ (tested with 8.0, 8.1, 8.2, 8.3)
  • Frameworks: Laravel, Symfony, WordPress, CodeIgniter, or any PHP project
  • Browsers: Chrome, Edge, Brave, Opera (Firefox coming soon)
  • IDEs: VS Code (PHPStorm support planned)

Contributing

We welcome contributions! Here's how to help:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/improvement)
  3. Commit your changes (git commit -m 'Add improvement')
  4. Push to the branch (git push origin feature/improvement)
  5. Open a Pull Request

Development Setup:

git clone https://github.com/zemmelmootez/phplocator.git
cd phplocator
# Extension development in /extension folder
# PHP development in root directory

License

This project is licensed under the MIT License - see the LICENSE file for details.

Links

⭐ Star this repo if PHP Locator improves your workflow!