Using Notepad++’s Function List plugin for PHP development
Jan 22, 2010 PHP Coding, Web Development, Work
One thing I really love about Notepad++ is the plugin’s that are available. One of such plugins that I enjoy is the Function List plugin to automatically search my code to pull classes, functions and much more into an easy to see pane on the right side of my screen. I had previously posted tutorials on another site but now I have made the process for “installing” these new rules easier by posting the XML as well as adding more features. Once you have followed the below steps the Function List plugin will show all of the following:
- PHP classes
- PHP class variables – (public, protected and private)
- PHP functions – already does this by default
- CodeIgniter Views
- CodeIgniter Helpers
- CodeIgniter Libraries
- CodeIgniter Models
- PHP include()
- PHP include_once
- PHP require()
- PHP require_once()
Update: I updated the instructions based on a comment below to close Notepad++ while editing the .xml file
Step 1: Close Notepad++
Step 2: Navigate to C:\Program Files\Notepad++\plugins\Config – This is the default installation folder, it may be different on your system.
Step 3: Open the FunctionListRules.xml file in your favorite editor other than Notepad++. The settings may not save if you open this file in Notepad++.
Step 4: Do a search for the following line: (This will more than likely be at the end of the file.)
<Language name="PHP" imagelistpath="">
Step 5: Add the following code between the opening and closing Language tags:
<Group name="Classes" subgroup="Functions" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="\{" keywords=""> <Rules regexbeg="class" regexfunc="[\w_ ]+" regexend="" bodybegin="\{" bodyend="\}" sep="" /> </Group> <Group name="Class Variables" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="public\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" /> <Rules regexbeg="protected\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" /> <Rules regexbeg="private\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Functions" subgroup="" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="\{" keywords=""> <Rules regexbeg="function[\s&]+" regexfunc="[\w_]+" regexend="\s*\(.*\)" bodybegin="\{" bodyend="\}" sep=";" /> </Group> <Group name="CodeIgniter Views" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='\$this->(.*)load->view\(['"]' regexfunc='["\/\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="CodeIgniter Helpers" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="\$this->(.*)load->helper\(array\(" regexfunc='[',"\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> <Rules regexbeg='\$this->(.*)load->helper\(['"]' regexfunc='["\w_]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="CodeIgniter Libraries" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="\$this->(.*)load->library\(array\(" regexfunc='[',"\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> <Rules regexbeg='\$this->(.*)load->library\(['"]' regexfunc='["\w_]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="CodeIgniter Models" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="\$this->(.*)load->model\(array\(" regexfunc='[',"\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> <Rules regexbeg='\$this->(.*)load->model\(['"]' regexfunc='["\w_]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Include" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='include\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Include Once" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='include_once\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Require" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='require\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Require Once" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='require_once\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group>
My full section including the Language tags looks like this:
<Language name="PHP" imagelistpath=""> <CommList param1="#" param2="" /> <CommList param1="//" param2="" /> <CommList param1="/\*" param2="\*/" /> <Group name="Classes" subgroup="Functions" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="\{" keywords=""> <Rules regexbeg="class" regexfunc="[\w_ ]+" regexend="" bodybegin="\{" bodyend="\}" sep="" /> </Group> <Group name="Class Variables" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="public\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" /> <Rules regexbeg="protected\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" /> <Rules regexbeg="private\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Functions" subgroup="" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="\{" keywords=""> <Rules regexbeg="function[\s&]+" regexfunc="[\w_]+" regexend="\s*\(.*\)" bodybegin="\{" bodyend="\}" sep=";" /> </Group> <Group name="CodeIgniter Views" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='\$this->(.*)load->view\(['"]' regexfunc='["\/\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="CodeIgniter Helpers" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="\$this->(.*)load->helper\(array\(" regexfunc='[',"\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> <Rules regexbeg='\$this->(.*)load->helper\(['"]' regexfunc='["\w_]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="CodeIgniter Libraries" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="\$this->(.*)load->library\(array\(" regexfunc='[',"\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> <Rules regexbeg='\$this->(.*)load->library\(['"]' regexfunc='["\w_]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="CodeIgniter Models" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="\$this->(.*)load->model\(array\(" regexfunc='[',"\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> <Rules regexbeg='\$this->(.*)load->model\(['"]' regexfunc='["\w_]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Include" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='include\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Include Once" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='include_once\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Require" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='require\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Require Once" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='require_once\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> </Language>
Step 6: Save and close, then open up a PHP file in Notepad++ to see if it shows the desired output in the Function List tool.
Related Posts
Tags: CodeIgniter, Coding, Function List, Notepad++, PHP, XML

February 17th, 2010 at 11:23 am
Super, vraiment super.
Juste un truc : il faut ajouter un espace après “class” sinon ça choppe par exemple un appel à class_exist() comme étant une classe…
Cela pourra t il être intégré au plugin ?
March 12th, 2010 at 4:15 pm
Excellent! It took a while to realize I needed to switch to tree view rather then list view to see class functions. Would be nice if “Class Variables” was a subgroup of “Classes” as well.
June 13th, 2010 at 6:09 am
Nice, but does not work – after reloading rules file becomes as it was, do not know why.
June 13th, 2010 at 6:15 am
ps. made file readonly – works now. thank you:)
June 25th, 2010 at 11:33 am
I wish I could get it to work. Function list says: no rule defined.
June 25th, 2010 at 11:43 am
This looks awesome. I was just dreaming that function list would actually work like I wanted it to for PHP (hadn’t considered CI), so I googled it, and here you are.
But, after closing npp, pasting code & saving, starting npp, opening a PHP file and function list and making sure the language was set to PHP, function list says: no rule defined.
I re-tried pasting the code several times in case there was an error there. To be clear, this is the exact same behavior I’ve always got from function list 2.1. I did try a fresh install.
These look like sweet features. Hope someone can help.
June 25th, 2010 at 11:59 am
Dusty, I will email you to see about resolving your issues.
June 28th, 2010 at 4:44 am
thanks! this worked great!
for anyone else who has problems: be sure to update the xml file using something OTHER THAN NOTEPAD++. i found that if i updated it in notepad++ it would save fine, but when i closed notepad++ and reopened it to test the new settings, it would get overwritten with its old settings. apparently upon closing notepad++ over-writes plugin config settings with whatever is in memory.
recap: completely close notepad++, open the xml file in Something Else, make your updates and save, and then open notepad++. that should do it!
June 28th, 2010 at 11:48 am
I got it figured out. My rules.xml file was located in documents&settings/user/appdata/notepad++/config
Thank you for helping, Daniel.
June 29th, 2010 at 2:17 pm
Hi Daniel,
I just had a quick question – in my function list, classes are one tree base, with functions a sub-tree of an individual class, while class variables have their own separate root outside of the class list and no indication as to what class they belong to. Is that just how it has to be, or can the class variables show up as a subtree of the class they belong to?
Not a big deal – just the difference between good enough and exactly what I want
.
June 30th, 2010 at 1:04 pm
Dusty, take a look at my latest post: Feature request for Notepad++ Function List plugin. This should answer your comment.
July 1st, 2010 at 9:48 am
I also can’t get this working. I’m on windows 7 and found the rules.xml file in C:\Users\username\AppData\Roaming\Notepad++\plugins\config but that isn’t working either.
When I went in to the plugin config in npp and tried to add a rule (for any language), npp crashes.
Anyone have any ideas?
July 6th, 2010 at 11:55 am
same problem with Michael. on Win7 changed the rules.xml file in both Program Files and Users but no go. npp crashes when i try to add a rule. help. this all sounds too good not to work. btw, i installed Function List v2.1
July 6th, 2010 at 5:22 pm
Michael or Melvin,
Contact me sometime after July 12. Try contacting me on Skype sometime after 7pm Eastern time if you speak English. I will see what I can do to help you out.
July 31st, 2010 at 4:04 am
Hello,
I’ve same problem than Michael & Melvin.
What is the issue of this ?
Windows 7, 64 bit.
I will create some rules about interface. Never mind. Npp crash.
path of install:
C:\Program Files (x86)\Notepad++\
July 31st, 2010 at 4:12 am
I(ve found:
if files (plgins/congif etc .. ) are copied respetcively in C:\Users\username\AppData\Roaming\Notepad++\, rules are found.
but i cant define a new rule in editor.
August 15th, 2010 at 5:45 am
In Win7 appdata is a “Junction”. So, CLOSE NOTEPAD++ (see why previously), then Explorer to C:\Users\username then Start Run %appdata% opend “real” place. Then look for Notepad++\plugins\config and OVERWRITE bad copy of FunctionListRules.xml with good copy from ProgramFiles\Notepad++\plugins\config
I do not understand why Notepad++ saves FunctionListRules.xml in user profile everytime it exits
August 16th, 2010 at 7:57 am
I had the same problem. You have to put the file at the path François said, but also set it to read-only, otherwise Notepad++ will overwrite it everytime it launches and make it empty again.
September 1st, 2010 at 2:40 am
Thank you everyone. Great advice. FunctionList now operating correctly on my PC
A couple of quick notes for newbies (like me)…
1) Even when configured correctly, FunctionList will say “No Rule Defined” until you open a file.
2) On XP, the %APPDATA% directory everybody talks about is a folder called “Application Data” and it will be in your “Documents and Settings” folder under your username.
Thanks again for the posts.
September 30th, 2010 at 11:01 pm
Hi all,
Fantastic post + Discussion! I’m having trouble adding function listing for a custom language called “Umajin” – I try to use the language name as defined by the ‘user-defined dialoge’ (accessible under view->user-defined dialogue)- but whenever I open one of my custom-language files, who have the extension .u, it says ‘no rule defined’.
I’ve found that the parsing rules do work on the language – when I go into the FunctionListRules.xml file and rename the language as Python, and then set the language as Python from the Language menu it works, but it means I can get highlighting _or_ function listing, but not at the same time! Has anyone got any ideas?
(I am using win7 enterprise 64-bit, it seems like that might make a difference)
December 21st, 2010 at 5:13 am
i am stuck at step 3 because the freaking file doesn’t even exist.
Step 3: Open the FunctionListRules.xml file in your favorite editor other than Notepad++. The settings may not save if you open this file in Notepad++.
January 6th, 2011 at 1:57 pm
1. Download function list Plugin here extract zip file. copy 3 files in zip package you extracted before into your install dir.
2. Edit file FunctionListRules.xml. as content in “STEP 5″ by notepad and save and copy this file
3. i am using Win 7. Start/run/ and input “%appdata%”. choose NotePad++/plugin. paste it here. and make it readonly.
4. open file PHP and enjoin
February 8th, 2011 at 3:53 am
Hi all,
I have some additional rules:
To see class variables in older php code, add:
It would be nice if these variables would appear in list groups “Var, Public, Protected, Private” under the given class in the list. I’m not regexpert though
To see global variables add:
I encountered some problems with comments inside class declarations, consider the following example:
class MyClass
{
public $public = ‘Public’;
private $private = ‘Private’;
function printPrivate()
{
echo $this->private;
}
/*
* print Public
*/
function printPublic()
{
echo $this->public;
}
}
The second function will not be listed. It is not just the layout of that specific comment – “/* .. */” comments inside a class in general seems to break things. I’m not sure how to fix that..
February 8th, 2011 at 3:57 am
Darn tag stripper
here are the rules again (add the less/greater than chars in each line):
To see class variables in older php code, add:
Rules regexbeg=”var\ ” regexfunc=”\$.*[^;]” regexend=”.*;” bodybegin=”" bodyend=”" sep=”" /
To see global variables add:
Group name=”Global Variables” subgroup=”" icon=”0″ child=”0″ autoexp=”4″ matchcase=”0″ fendtobbeg=”" bbegtobend=”" keywords=”">
Rules regexbeg=”global\ ” regexfunc=”\$.*[^;]” regexend=”.*;” bodybegin=”" bodyend=”" sep=”" /
/Group
.
May 16th, 2011 at 10:39 am
Hi, I am really wanting to add this plugin, but where is the actual download for the zip file?
May 24th, 2011 at 1:12 pm
Mike, you can download the plugin at the sourceforge.net plugin download page. Click here
June 8th, 2011 at 8:30 am
Hi,
I have exactly the same problem as Brandel. I have a user-defined language called Chalice which is somewhat similar to C++. I opened the FunctionListRules.xml with some other editor, copied the language block for C++, named it Chalice, saved the XML file and started Notepad++.
The new rules show up as expected in the Parsing Rule view, but if I press “try” nothing happens, i.e. “No Rule Defined”. In contrast, if I press “try” after selecting C++ my code gets processed as expected.
Has anybody been able to resolve this issue?
Thanks,
Malte
June 8th, 2011 at 8:33 am
P.S.: I am running Windows 7 x64, FunctionList 2.1 UNI and the unzipped, i.e. not installed, version of Notepad 5.9.2 Unicode.
July 25th, 2011 at 3:30 am
Hi,
I have copied the FunctionListRules.xml into my notepad++/plugins/APIs or config/ folder but i can’t see the Function List tool in my Editor view.Can anyone tell me the reason.I am using windows7.
Thanks & Regards,
Senthil A
August 10th, 2011 at 8:28 am
@Daniel, Thanks for this fantastic post!
@Senthil, may be you need to put your FunctionListRules.xml to you %AppData% diretory, in windows 7 C:\Users\Lixas\AppData\Roaming\Notepad++\plugins\config\FunctionListRules.xml
August 10th, 2011 at 11:37 pm
I have copied the FunctionListRules.xml into my notepad++/plugins/config/ folder but i can’t see the Function List.
I have also added it to the C:\Users\username\AppData\Roaming\Notepad++\plugins\config\FunctionListRules.xml directory and also made them both read only
When I run the function plugin all I get is require_once ../../includes/initialize.php
This is at the top of the php script that I loaded into notepad++
I have tried this over and over and still no results
August 11th, 2011 at 12:21 pm
@Richard, Did you close out of Notepad++ before you made the changes to the FunctionListRules.xml? What operating system are you on? Try adding a rule in the editor inside of Notepad++ and then check the FunctionListRules.xml file to see if it added it to the list or not.
August 19th, 2011 at 6:11 am
Selected function background is currently in blue. When the focus is not in the function list frame, then the current function is highlighted in grey.
Light grey background is hard to see, so I would like to change it.
How can I change the active and inactive line background color?
Could you put a color change possibility into config file?
Thanks!
August 26th, 2011 at 8:05 am
The plugin 1.21 does not work with Notepad++ 5.9
I am troubleshooting this at the moment.
Not recognizing any rules at all.
Seems like a good plugin.
August 26th, 2011 at 8:06 am
Sorry! I meant version 2.1 of the plugin
September 1st, 2011 at 4:19 am
@Waschman: Please let me (and others) know if you manage to get the plugin working again. That would be great!
September 2nd, 2011 at 2:26 pm
RE: path for files
Maybe this will save somebody some trouble:
I’m running Notepad++ v5.9.3 and Function List v2.1 on Win 7 Home Premium on a x64 machine. I was having problems with this path thing but finally got Function List to list functions for my MQL4 code when i select one of the C languages. Not able to add any group or rule yet from the Parsing Rules dialogue box yet without crashing NPP. Curiously, if i try to view the results for VB, it will also crash NPP.
Anyways, i had trouble with path till i found “Run” in Accessories and typed in %appdata% notepad++
This revealed the path/folder to where this legendary extra FunctionListRules.xml file was located. Sure enough, it was only 1 KB instead of 33 KB. So i took someones advice and overwrote the 1 KB file with a fresh 33 KB (the size of my original file) file, and for the hell of it, changed it to read-only. Finally! I’m starting to get results. For the hell of it, i reverted it from read-only to what it was before and it seems to not be bothered when NPP opens and closes.
Don’t make the mistake i made re: path. I manually searched for the path of this elusive appdata (in Win 7) or application data (in XP) folder by unhiding hidden folders. I first went c:\Users\default\AppData\Roaming
…but i found no Notepad++ folder! So i made one, and also a plugin\config and put the files in there! That was a waste of time because it was a wild goose chase. I had somehow not seen there was another path that goes more like this:
c:\Users\Owner\AppData\Roaming\Notepad++
To see AppData folder, you have to go to Organize>Folder and search options…
Whew!
Now if i can just edit in some rules without crashing NPP!
October 7th, 2011 at 1:09 pm
Still, thank you. I’m using Windows 7 and your instructions are the ONLY ones that worked completely without the need for any extra steps.
Many thanks!
Ten