├── .windsurfrules ├── README.md ├── devtools.html ├── devtools.js ├── image.png ├── manifest.json ├── panel.html └── panel.js /.windsurfrules: -------------------------------------------------------------------------------- 1 | This is a local chrome extension to add a PHP console to your DevTools. 2 | 3 | This extension is utilizing the web tinker package by spatie: https://github.com/spatie/laravel-web-tinker. 4 | 5 | What it does, is it basically iframes the /tinker route into the extension. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP Console for Chrome DevTools 2 | 3 | A simple Chrome extension to iframe a PHP console. This package utilizes [Spaties Laravel Web Tinker](https://github.com/spatie/laravel-web-tinker) package, and iframes it in the devtools panel, making it accessible from anywhere in the panel. 4 | 5 | ## Installation 6 | 7 | 1. Download and unzip this project. 8 | 2. Navigate to `chrome://extensions/` in your browser. 9 | 3. Enable "Developer mode" in the top right corner (if not already enabled). 10 | 4. Click "Load unpacked" and select the `php-ext` folder. 11 | 5. Within any Laravel project, install the Spatie Laravel Web Tinker package: `composer require spatie/laravel-web-tinker` 12 | 13 | ## Run Tinker in DevTools 14 | 15 | Now, you'll see a PHP tab in the console. Click on this to open PHP console and run your Laravel/PHP code. 16 | 17 |  -------------------------------------------------------------------------------- /devtools.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /devtools.js: -------------------------------------------------------------------------------- 1 | 2 | chrome.devtools.panels.create( 3 | "PHP", 4 | "", // No icon 5 | "panel.html", 6 | function(panel) { 7 | console.log("PHP Console panel created!"); 8 | } 9 | ); 10 | -------------------------------------------------------------------------------- /image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnylea/php-ext/9a4ba13b5fed2f767cb5301cd4161f7256ffddcb/image.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PHP Console", 3 | "version": "1.0", 4 | "manifest_version": 3, 5 | "description": "A DevTools extension to iframe the PHP Console.", 6 | "devtools_page": "devtools.html", 7 | "permissions": ["tabs"], 8 | "icons": { 9 | "128": "image.png" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /panel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /panel.js: -------------------------------------------------------------------------------- 1 | chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { 2 | const currentTab = tabs[0]; 3 | const url = new URL(currentTab.url); 4 | const tinkerUrl = `${url.origin}/tinker`; 5 | document.getElementById('tinkerFrame').src = tinkerUrl; 6 | }); 7 | --------------------------------------------------------------------------------