Working with projects in phpDesigner 7

Starting a new project can be tricky. There are lots of files to think about, functions to keep track of, variables, classes, and more. But phpDesigner 7 has tools that can help you making projects a lot easier. We'll discuss a few of these tools here:

  • Project manager
  • Project panel
  • Code explorer for PHP
  • Declaration toolbar
  • Todo and bug managers
  • SVN integration
  • FTP integration
  • File snapshots

All the panels featured in this tutorial can be found within the View menu. Everything else will be listed within the appropriate section.

Project manager

The first thing you want to do when you start a new project is group the files together for easy access. This can be hard if you use several pieces of code in different places, but phpDesigner 7 allows you to group code, no matter where is it, into one easy-to-manage project. To begin, open phpDesigner 7 and go to Project > Project Manager (F11) > New. Type in a name for your project, the project root (where most of your application will be), and a description of your project.

Then proceed to the filters page. phpDesigner 7 is mainly for PHP, and so it only includes PHP in your project, but it has syntax highlighters and support for other files as well, so if you'll be dealing with .js, .css, xml, perl or some other language, click on Include Files, and Add a filter. * acts as a wildcard, so to add support for .js and .css files, use *.js and *.css as filters for example. Any new filters you make will appear in bold font. If you want to include everything (files or images), click the Default button. It will add a single wildcard (*), which will make it include everything. The same applies for including/excluding folders. You can also change the kind (what that filter applies to), and match method (how it finds out if a file is to be included), by right clicking on the fields, and selecting from the drop down box.

If you use downloadable libraries or frameworks (such as Zend or Smarty) that are outside of the Project root, you can add or remove them on the Frameworks/Libraries tab. Doing this will allow you to write faster code by having its functions and classes available for viewing without searching documentation. For this tutorial, we will add them to show what PHPD is capable of.

If you have a local web server you are working from, which you would like to use when testing (advised), then you can configure it on the localhost tab.

When you've finished configuring, click OK, and your new project will appear in the Project Management box. At the bottom of the screen, click Open Project to get started.

Project Panel

By now you will have seen a little panel like the one above pop up on screen, floating or docked to the side of PHPD. This is the Project panel, the place to view all files you set with filters from your Project root.

If you click on the second button on the panel (the Project Files one), you will see it's already populated by files from the Smarty Library and Zend Framework we added earlier. You can search incrementally (that is, the results update as you type) for a file, then open it up for viewing. Let's close the box and continue.

The first thing you'll want to do, if you have a need to do this step, is import any current work you have. If you selected an existing folder when creating your project, it would have done this automatically, but for this tutorial, we started with a blank folder, so we need to import something from an existing project. Click the Import folders/file button on the Project panel, browse to the folder or file you wish to import, and click OK. In a second or two, the folder/file will appear in the panel and it will now be part of the project. Notice that the file exists in both the old and the new folders. It makes a copy of it, so you don't break anything. Using this, you can create branches of your work, while still maintaining your core code.

The forth button on the panel allows you to open a selected file, or to insert its file name, or full file path into the current document. So, if you have a file with a long, complex name you'd rather not type, you could use this shortcut.

Lets begin work. To open a file from the panel, you can double click it, click the Open button (4th button in the panel), or click and drag the file to the editing part of the screen. Once open, you can code as you normally would, save, and close the file.

To add a new folder to the project, select the Create a new Folder button, give it a name, and select OK. You can create, move, and delete files and folders all within PHPD, so you don't need to use an external file browser like Windows Explorer to do this.

The other two buttons, Reparse Project, and Unload Project are rarely used, but for completeness, I'll explain what they do.

Reparse project reloads the project you're in when you add/move/delete a file or folder outside of PHPD. These changes (along with access to their classes methods, functions and such) will not show up until you reload the project. The same applies for libraries/frameworks. If you add one, reparse the project, so you can take advantage of all PHPD has to offer.

Unload project allows you to get out of a project, to clear the Project panel. I'm not sure why you'd want this, but its there in case you need it.

PHP Code Explorer

When a file gets quite large, with many variables, functions, classes, requires/includes, constants, and interfaces, it can be quite hard to find where something is, especially if you can't remember its name and therefore can't use search. PHPD has an built-in Code Explorer, which makes things easier. It lists all of the items listed above in the currently viewed file, and links them with information such as where it is declared (line and character position), links it so a double click will jump to it, and also prints information from any phpDocumentor tags preceding it.

Declaration Toolbar

Earlier, in the Project Panel section, we took a look at the Project Files page, which listed all files in your project root, as well as those in the libraries or frameworks you added. In the Declaration toolbar (declaration is something that is declared for the first time, such as classes, functions, constants, and variables) we have 4 new buttons which help find and access parts of your code very quickly (especially for large projects).

  • Allows you to view and search through declarations in the currently viewed file.
  • Displays and allows you to search through declarations in all files in your project root, as well as libraries and frameworks you added when you created the project, as shown in the image below.
  • and Allows you to jump between declarations in the currently viewed file.

Todo and Bug Managers

When a project is developed by several people, usually through a source control system like Subversion (see next section), a todo or bug list comes in very handy. But it can often be tiresome to open the file, add the file, add the line number, add a description and save it. Enter phpDesigner. Its built-in todo and bug lists save a heap of time, and what's more, they come in two different sections, each with its own advantages.

Program Todo/Bug Manager

On the image above, you can see the Program Todo and Bug managers. They allow you to add items, remove them, sort them, prioritize them, change their completion status, and export to either CSV (comma separated values) or HTML, which makes it extremely easy to show others what's left to do.

The upside of this method is that it allows you to see how close your project (or what you've made so far) is to completion. The downside to these panels is that they save to the program, and not the project you are working it. That means that, even though you can label which project this item belongs to, a todo/bug item from another unloaded project will also be shown in the list, even if its not relevant. This is where Inline Todo/Bug lists help.

Inline Todo/Bug Lists

When you're editing a file, you quite often enter comments of things to do that get lost over time as the file grows. phpDesigner 7 has inline todo and bug tools that display all comments containing a certain prefix, so that when you are next editing the file, a list will be displayed showing all todo or bug comments you or someone else editing the file with phpDesigner left from last time.

The upside and downside to using this feature is the same thing: Using inline is that they relate only to the file you have viewed. Thats great because you don't get things from other projects showing in the list when you aren't working on that project, but it can also be annoying because it won't show items from all currently opened files. So, at the moment there is no real way of seeing todo/bug items from a selected project using either method (its either all or one). This might change in the future. I don't know.

SVN Integration

phpDesigner 7 integrates with your TortoiseSVN installation to add, commit, update, and merge files and folders for a shared project. Nothing special here. The commands can be found in Tools > SVN, and if the TortoiseSVN path is set up correctly in Preferences (CTRL+E > Integrations > TortoiseSVN), then you can quickly and easily manage your project from within phpDesigner. This is simple, and makes things much faster. Better SVN integration may be on its way (such as highlighting changes, merged, added, removed, etc. folders within the project manager panel you used earlier)…. anything is possible.

FTP Integration

FTP Integration allows you to view, edit, and save remote files. Sadly, at the time of writing this tutorial, there are some serious issues with the built-in FTP which need to be resolved. At the moment, you can add an FTP server, connect/disconnect, create folders, and upload files. However, in the tests I did, several files were emptied (12kb file down to 0kb), and directory listing does not work so it's very hard to navigate. This section will be updated when FTP is fixed, hopefully within a few releases.

File Snapshots

File snapshots are a quick and easy way of backing up your code when you reach a particular milestone. So, if you break something in the future, you can find out what your code was like before, and compare to see where something might have gone wrong. It's a rather easy alternative to a source control system like SVN. Sadly, at the time of writing this tutorial, file snapshots, like FTP, seems to be broken :( I make make and remove snapshots easily, but when it comes to restoring an old one, viewing, then restoring the newer one, it just won't work. This and the FTP features make for excellent tools, and it's my hope these features are fixed soon.

Remarks

That concludes this tutorial on Project management. I hope you find the information helpful, and that you are able to apply it to your project to make development faster and more efficient.

As you have read, there are still bugs to fix. But once these are fixed, phpDesigner 7 will be more efficient than ever at managing your project.