Skip to content

Repository files navigation

Composer Autoload Explorer

Go Version License

A beautiful terminal UI (TUI) for exploring Composer autoload files in PHP projects. Navigate PSR-4 namespaces, autoload files, and namespaces with syntax highlighting and an intuitive interface.

Screenshot

Features

  • Three View Modes:

    • PSR-4 autoloading (namespace → directories)
    • Autoload files (file list)
    • Namespaces (PSR-0 autoloading)
  • Interactive Navigation:

    • Browse namespaces and files in a split-pane interface
    • View file contents with syntax highlighting and line numbers
    • Filter namespaces/files with real-time search
  • Beautiful TUI:

    • Syntax highlighting for PHP files
    • Dark theme optimized for terminals
    • Responsive layout that adapts to terminal size
    • Item count display on left pane
  • File Watching:

    • Automatically refreshes when autoload files change
    • No need to restart the application

Installation

Using Go Install

go install github.com/dwjordan/autoloadx/cmd/autoloadx@latest

Make sure $GOPATH/bin or $GOBIN is in your PATH.

From Source

git clone https://github.com/dwjordan/autoloadx.git
cd autoloadx
go build -o autoloadx cmd/autoloadx/main.go

Cross-Compilation

Linux:

GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o autoloadx-linux cmd/autoloadx/main.go

Windows:

GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o autoloadx.exe cmd/autoloadx/main.go

Usage

Run autoloadx from within a Composer project directory (one that has a vendor/composer directory):

autoloadx

The application will automatically find the project root by searching for vendor/composer in the current directory and parent directories.

Command Line Options

  • -v, --version - Display version information and exit

Key Bindings

Global

  • 1 / F1 - Switch to PSR-4 autoload mode
  • 2 / F2 - Switch to autoload files mode
  • 3 / F3 - Switch to namespaces (PSR-0) mode
  • q / Ctrl+C - Quit
  • ? - Show help popup

Left Pane

  • / w - Move up
  • / s - Move down
  • / - Filter items

Right Pane

  • / k - Scroll up
  • / j - Scroll down
  • h / a - Scroll left
  • l / d - Scroll right

Press ESC or q to close the help popup.

Requirements

  • Go 1.25.1 or later (for building from source)
  • A PHP project with Composer autoload files (vendor/composer/autoload_*.php)
  • A terminal that supports ANSI colors and 256-color mode

Building

# Build for current platform
go build -ldflags="-s -w" -o autoloadx cmd/autoloadx/main.go

# Build optimized (smaller binary)
go build -ldflags="-s -w" -trimpath -o autoloadx cmd/autoloadx/main.go

How It Works

The application reads Composer's autoload files:

  • vendor/composer/autoload_psr4.php - PSR-4 namespace mappings
  • vendor/composer/autoload_files.php - File-based autoloading
  • vendor/composer/autoload_namespaces.php - PSR-0 namespace mappings

It then provides an interactive interface to explore these mappings, view file contents, and navigate the autoload structure.

Troubleshooting

"could not find vendor/composer directory"

Make sure you're running autoloadx from within a Composer project directory, or in a subdirectory of one. The tool searches upward from the current directory to find the project root.

Colors not displaying correctly

Ensure your terminal supports 256-color mode. Most modern terminals support this by default. If colors still don't work, try setting TERM=xterm-256color.

PHP not found

The tool requires PHP to be installed and available in your PATH to parse Composer autoload files.

Changelog

See CHANGELOG.md for a list of changes in each version.

License

MIT License - see LICENSE file for details.

About

Composer Autoload Explorer

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages