A PHP Reference Tool for gEdit

If, like me, you write PHP code in gEdit, then you may find this reference tool helpful. PHP has excellent documentation online, but it's a bit of a pain to switch back and forth between your editing tool and your browser just to find the order of arguments for a particular function. I wrote a PHP script and created a list of PHP functions to handle these lookups for me. These instructions describe how to install it in gEdit.

External Tools Manager

First, you'll need the External Tools Manager plugin for gEdit. To turn this on, do the following.

  • Select Edit, Preferences.
  • Select the Plugins tab.
  • Check the box next to External Tools.
  • Close the preferences.

PHP Lookup Tool and Function List

Next, you'll need my PHP lookup tool and my list of PHP functions. Download phpfunc.txt and phpref.php from my Plain Text List of PHP Functions and Their Arguments page.

  • Put those files in your home directory.
  • Edit the phpref.php file and change the path to the phpref.txt file to the full path on your system (i.e. /home/joel/phpref.txt).
  • Create a link to the phpref.php file in /usr/bin.
cd /usr/bin
ln -s /home/joel/phpref.php phpref
  • Run the following command to test that it works.
phpref echo

Adding the Tool to gEdit

Finally, we want to add the new tool to gEdit.

  • Open the External Tools Manager.
  • Add a new tool.
  • Call it PHP Reference.
  • Enter a short description.
  • Set the shortcut key you prefer, I use <Control>r.
  • Set the command to the following.
xargs -I '{}' phpref '{}'
  • Set the input field to Current selection.
  • Set the output field to Display in bottom pane.
  • Set the applicability field to All documents.

Using It

Now, you should be able to highlight any function name in gEdit and press <Control>r to look it up. If you can't remember the exact function name, try looking up something like “mysql”. All functions that start with “mysql” will be displayed.

comments powered by Disqus
php/a_php_reference_tool_for_gedit.txt · Last modified: 2020/06/01 22:53 (external edit)