Visual Diff-Merge is a web-based tool for comparing, selecting, and merging code changes. With a split-view interface, it lets you view two versions side by side for easy diffing and merging. Built with PHP and JavaScript, it supports automatic language detection and syntax highlighting for over 180 programming languages, including HTML, Twig, PHP, JavaScript, JSON, TypeScript, Python, Ruby, Java, C#, CSS, XML, YAML, Markdown, SQL, and many more.
🔥 Try it online at visual-diff-merge.miglisoft.com - No installation required!
- Side-by-side comparison of files with syntax highlighting
- Interactive merge capability to select changes from either version
- Multiple comparison modes:
- File Browser: Compare files from a server directory
- File Upload: Upload and compare two local files
- Text Compare: Paste code snippets directly for comparison
- URL Compare: Compare content from two URLs
- Syntax highlighting powered by highlight.js with support for over 180 programming languages
- Responsive design that works on desktop and tablet devices
- Customizable themes with both dark and light modes
- Language internationalization support
Visit visual-diff-merge.miglisoft.com to use the tool immediately:
- Upload your files
- Paste code snippets
- Compare content from URLs
- (Note: File Browser mode has limited functionality in the online version)
Visual Diff Merge is a client-server application that requires both PHP backend and JavaScript frontend:
- Download or clone the repository
- Configure your PHP environment (see Installation)
- Copy
api/config.example.php
toapi/config.php
and adjust settings - Access one of the example files through a web server:
diff-viewer/file-browser.php
- Browse and compare server filesdiff-viewer/file-upload.html
- Upload local files to comparediff-viewer/text-compare.html
- Compare text/code snippetsdiff-viewer/url-compare.html
- Compare content from URLs
- PHP 7.4 or higher
- Web server (Apache, Nginx, etc.)
- Node.js 14.x or higher (for development only)
- npm 6.x or higher (for development only)
-
Clone the repository:
git clone https://github.com/migliori/visual-diff-merge.git cd visual-diff-merge
-
Install PHP dependencies:
composer install
-
Configure the project:
- Copy
api/config.example.php
toapi/config.php
- Modify configuration options as needed (see Configuration)
- Copy
-
Set up your web server to serve the project directory
- Ensure PHP is properly configured
- Make sure the
api
directory is accessible
Visual Diff Merge offers four distinct usage modes, each requiring specific files and setup:
- Required Files:
file-browser.php
file-browser.min.js
- Description: Browse files on the server and select two for comparison
- Example:
diff-viewer/file-browser.php
- Required Files:
file-upload.html
file-upload.min.js
- Description: Upload two files from your local machine
- Example:
diff-viewer/file-upload.html
- Required Files:
text-compare.html
text-compare.min.js
- Description: Enter or paste code snippets to compare
- Example:
diff-viewer/text-compare.html
- Required Files:
url-compare.html
url-compare.min.js
- Description: Enter URLs to fetch and compare content
- Example:
diff-viewer/url-compare.html
Each mode uses a specific manager component to handle its unique workflow before initializing the core DiffViewer component.
Visual Diff Merge uses a PHP configuration file to control both server and client behavior:
- Location:
api/config.php
(copy fromapi/config.example.php
) - Controls both PHP (server-side) and JavaScript (client-side) settings
- If no custom configuration file is created, the tool will use default settings as detailed in the documentation
'php' => [
'debug' => [
'enabled' => true, // Enable server-side debugging
'logLevel' => 3, // Log verbosity level (1-3)
'logFile' => 'debug-php-diff.log' // Log filename
],
'diff' => [
'contextLines' => 3, // Number of context lines around changes
'ignoreWhitespace' => false, // Ignore whitespace in comparisons
'ignoreCase' => false // Ignore case in comparisons
],
// Security settings, path configurations, etc.
]
'javascript' => [
'lang' => 'en', // Default UI language
'debug' => false, // Enable client-side debugging
'logLevel' => 2, // Client-side log verbosity level
'theme' => [
'defaultFamily' => 'atom-one', // Syntax highlighting theme
'defaultMode' => 'dark', // Light or dark mode
'showSelector' => true // Show theme selector in UI
],
// UI class customizations, translations, etc.
]
For complete configuration options, see the Configuration Documentation.
Visual Diff Merge follows a client-server architecture:
-
Backend (PHP):
- Processes diff calculations via the
DiffViewer
PHP class - Provides API endpoints for file access and diff processing
- Manages security and file system access
- Processes diff calculations via the
-
Frontend (JavaScript):
- Mode-specific manager components handle UI interactions
- Core
DiffViewer
component displays and manages diffs - Theme system provides syntax highlighting and UI theme options
See the Architecture Documentation for more details.
If you want to modify the source code:
-
Install Node.js dependencies:
npm install
-
Development mode with auto-rebuild:
npm run dev
-
Build for production:
npm run build
src/
— Source JavaScript filescomponents/
— Core components including DiffViewerutils/
— Utility functions
php/
— PHP classes for backend processingapi/
— PHP API endpointsdist/
— Compiled JavaScript files (generated)diff-viewer/
— Visual Diff Merge implementationsdocs/
— Documentation
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Fully supported: Chrome, Firefox, Safari, Edge (latest versions)
- Partial support: Internet Explorer 11
- Mobile: Works best on tablets; limited functionality on smartphones
This project is licensed under the MIT License - see the LICENSE file for details.
- highlight.js for syntax highlighting
- PHP-Diff for the diff generation
📚 Documentation: visual-diff-merge.miglisoft.com/docs/ 🌐 Website: visual-diff-merge.miglisoft.com 💬 Issues: GitHub Issues