Tutorial on how to use the project manager in phpDesigner 2008

blahboatsInternet and Web Development

Dec 13, 2013 (3 years and 9 months ago)

3,200 views

Tutorial on how to use the project manager in
phpDesigner 2008

From MPSOFTWARE

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 phpDeveloper

has tools that help making projects a lot
easier, and in this tutorial, we'll discuss a few such as



Project Manager



Project Panel



PHP Code Explorer



Declaration Toolbar



Todo and Bug Managers



SVN Integration



FTP Integration



File Snapshots

All the p
anels featured in this tutorial can be accessed somewhere within the View menu on the
program's File toolbar. Everything else will be listed within the appropriate section.


Contents

[
hide
]



1 Project Manager



2 Project Panel



3 PHP Code Explorer



4 Declaration Toolbar



5 Todo and Bug Managers


o

5.1 Program Todo/Bug

Manager

o

5.2 Inline Todo/Bug Lists



6 SVN Integration



7 FTP Integration



8 File Snapshots



9 Conclusion

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 PHPD allows
you to group code, no matter where is it, into one easy
-
to
-
mana
ge project. To begin, open PHPD
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. PHPD is mai
nly 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 wi
ldcard, 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 sel
ecting 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 h
aving 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
Manageme
nt 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 al
l 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 increme
ntally (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 exi
sting 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,
brows
e 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 do
n'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 e
diting 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 folde
rs 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 reload
s 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 y
ou 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 bu
ilt
-
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, an
d 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 (especial
ly for large projects).

1.

Allows you to view and search through declarations in the currently viewed file.

2.

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 crea
ted the project, as shown in the
image below.


3.

and 4. 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 (se
e 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 mor
e, 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 complet
ion 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 comple
tion. 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 has inline todo and bu
g 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 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 cor
rectly 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, creat
e 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 ol
d 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.


Conclusion

That concludes this tutorial on Project management. I hope you find the info
rmation 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 will be more
efficient than ever at managing your proje
ct.


If you have any questions or comments, please post them on the forum or on the wiki discussion
page. Thank you for reading.



Tutorial on how to use the debug features in
phpDesigner 2008

From MPSOFTWARE

If you have configured XDebug

to work, then its time to try it. There are nine main things
discussed in this tutorial.



XDebug
-

What is it?



Breakpoints



Call stack



Evaluate



Watches



Content variables



Event Log



Profiling



PHPD2008 Controls

Before we start, you'll need to make su
re that some things are enabled. Firstly, right click the
bars at the top, and make sure that the Debug toolbar is enabled. Secondly, go to View >
Toolpanels, and make sure all 6 at the bottom (Breakpoints through to Event Log) are all
enabled. How you gro
up them and where you store them is up to you, but make sure they are
accessible.


Next, go to Debug > XDebug IDE Server, and start it. If its already started, restart it and make
sure there are no problems when its starting back up (check the Events Log
for this, It should say
it has stopped and then started).


With these in view, and debugging ready, lets get started.


Contents

[
hide
]



1 XDebug
-

What is it?



2 Breakpoints


o

2.1 Setting Breakpoints

o

2.2 Turning on/off Breakpoints



3 Call Stack



4 Evaluate


o

4.1 Setting an evaluation



5 Watches


o

5.1 Setting a watch

o

5.2 Viewing Watched variables



6 Context Variables



7 Event Log



8 Profiling


o

8.1 Profiling your script



9 PHPD2008 Controls



10 Conclusion

XDebug
-

What is it?

XDebug

is an open source debugging and profiling tool available to developers. Its built in
features are the structure of PHPD2008's debugging support. It provides detailed information of
how your scripts process.


XDebug is NOT a tool for fixing your applicati
ons. If there is an error, you have to deal with it
the normal way, find and fix the problem. XDebug does provide you with information to find
where the problem starts, which helps you to fix problems quicker than without it.


So without any further delay
, here is how to debug your script:


Breakpoints


Breakpoints are exactly as they sound and are the core of the debug process (without using them,
the only thing you can do is profiling). No matter what your script is doing at the time, the debug
process

will halt when it reaches a break point. They are used to stop and examine context
variables, view the vars you are watching or the current call stack (more on these later) at a
particular part of the script. Setting multiple breakpoints, you can easy fin
d out a section of code
where things are not working as they should by examine the data with each stop.

Setting Breakpoints

There is no shortage of ways to add breakpoints. The 2 easiest are pressing F5 while your mouse
is on the line to want to break at, or clicking the gutter of line you want to break at. Other ways
include going to Debug > Toggle Breakpoint, right clicking a

line and selecting "Toggle
Breakpoint", clicking the hand in the Debug Toolbar, or clicking in the breakpoint panel, and
selecting new (very slow because you need to specify an exact file path and line number).

Turning on/off Breakpoints

If you have quit
e a few breakpoints, your script will stop very often. You could remove
breakpoints to speed things up, but then you'd have to re
-
add them later. PHPD has the ability to
disable a breakpoint instead, while still leaving it in the breakpoints panel. To do t
his, either
uncheck the checkbox next to the breakpoint in the panel, or right click the breakpoint in the
panel and select disable. Same thing for enabled. From the right click menu, you can also
enable/disable all breakpoints at once. When a breakpoint i
s disabled, it shows up as a grey dot
in the page gutter.


Call Stack


The Call Stack allows you to see how you got to a certain break point in your debug session. The
stacks are sorted with the most recent call at the top, down to the first call (main)
at the bottom.
Using this, you can see how your script gets to a certain point, to determine if its taking a wrong
turn. A basic usage would be 3 functions. The first takes a string or integer, determines what its
got, and then puts that through one of the

two other functions to process based on its type. If the
string is being passed to the integer function, you'll see this in the call stack.


Evaluate


Evaluate allows you to evaluate and text expressions in your script, as well as set variables for
debu
gging purposes. If you want to debug a page which needs the $_GET['pageID'] variable to
be set to "2", then place a break point before the variable is used, run the debug to get to the
break, set the variable inside the Evaluate panel, and continue with th
e debug process. Your
script should now run from the breakpoint, with the $_GET['padeID'] set to what you need.
Alternatively, you can just put $_GET['padeID'] = 2; in your script where you're breakpoint is,
but it can get rather messy if you have to set a

few of them throughout the script.

Setting an evaluation

Go to the Evaluation panel, and type the evaluation in the input box at the top.


Watches


If, at the end of your script, something isn't turning out as it should because a variable is
changing to something it shouldn't, the watches panel allows you to monitor that variable at each
break point throughout the debug process. You can monitor object
s and properties as well as
variables. Monitored variables should start with a “$” (dollar sign).

Setting a watch

Go to the Watches panel, right click, and hit Add, press CTRL+F5, or click the eighth icon in the
debug toolbar. Type the object, property or

variable you want to watch (must begin with a $).

Viewing Watched variables

As your script processes, the watched variables update. If you're watching an object, click the
little + button next to name to view all properties and their values inside that o
bject. When you
see a change that shouldn't have happened, you can tell that the change happens somewhere
between the last break point, and the current one. From there, it should be very easy to find the
cause (depending on how far apart your breaks are).


Context Variables


Context variables work very similar to Watches with one main difference. Rather than watching
a particular variable, context variables monitors all variables, objects and properties during the
debug session, including Super Globals li
ke cookie, get, post, and session. This can be quite
handy for example, if you set a break point at the end of you script, hit Debug, and view what
everything is set to at the end of the script. If you find a problem variable, you can also right
click it,
and add a watch, making it easier on your next debug session to see where that one is
changing.


Event Log


The event log is just output of what PHPD does, step by step, in text format. It logs sessions
started/ended, breakpoints reached, and when the De
bug Server is started/stopped. Its main use is
to check Debug is actually usable (IDE has started). If you're restarting, but it wont work, check
this panel to see if its actually able to start. If it doesn't, a configuration is wrong.


Profiling


As scr
ipts get bigger and more complex, it can be hard to tell where a script is slowing down. A
query, a loop or other action can be so embedded, it could takes ages timing each one. But
XDebug automatically times each function, query, and method call, and outp
uts a file that can be
views in KCacheGrind or WinCacheGrind. By using profiling, you can find out which part is the
slowest in a script within moments. PHPD automatically allows you to open up the output in
WinCacheGrind if configured to do so. And with t
he information, you can speed up your scripts
making things nicer for everyone.

Profiling your script

Its very simple. Remove/disable all breakpoints, and click either the profiling button (ninth) in
the Debug Toolbar, or type ALT+P. It will run through,
and if there is no errors, you'll get a
profiling opening box at the end. Open the top one, and you should get something like this:



PHPD2008 Controls


PHPD has a few controls for making things easy. On the Debug toolbar:

1.

The debug session manager. It starts a debug session, or continues with one already
existing.

2.

Terminates a session you are currently in, for example, if you get into a continuous loop.

3.

Going over you code step by step as PHP processes it. It's a slow pro
cess so try narrow
the point of error using breakpoints and watches first.

4.

Steps into a class, function, include or require. Useful if you know a problem exists in
that function.

5.

Steps over a class, function, include or require. Useful if you know a prob
lem doesn't
exist in that function.

6.

Runs until it returns to a parent class, function or page.

7.

Adds a breakpoint to the line the cursor is on.

8.

Allows you to add a watch to one of the variables.

9.

Profiles the page you are on.

10.

and 11. Current do not work
, but the options in Debug menu do (they allow you to run
with php.exe and set command line options)

11.

Checks your pages PHP syntax for any errors.


Conclusion

And thats it. I've described all the different areas of PHPD Debugging functions and their
contr
ols. There are other uses for each one of these, but the ones I have listed are what I have
found to be the most practical use for them.


I hope to have some more tutorials released in the future. Send any questions or comments
regarding this tutorial via

PM on this forum.


Thanks for reading.


Tutorial on how to do external debugging in
phpDesigner 2008

From MPSOFTWARE

Instructions for configuring External debugging in phpDesigner 2008


By styson,
http://forum.mpsoftware.dk/viewtopic.php?f=34&t=3251&p=10357


Assumption:
You have debugging working with XDebug

already and are using XAMPP on your
local workstation for development and debugging If you do not, see the Howto for Xdebug and
XAMPP


-

Copy the php.ini file from C:
\
xampp
\
php
\

to C:
\
xampp
\
apache
\
bin. This will overwrite the file
that apache uses. Make b
ackups if feel it is necessary.

-

Edit the php.ini file located in C:
\
xampp
\
apache
\
bin and uncomment this line:
extension=php_xdebug.dll and add xdebug.remote_mode=req to your Xdebug section of the file.

-

Save the file.

-

Restart Apache

Instructions f
or using Firefox to initiate the debugging session. This is the recommended
approach.


Download the Xdebug plugin located here:
http://gmckinney.blogspot.c
om/2008/02/x

... g
-
and.html

In firefox, open the add
-
ons menu (tools
-
> Add
-
ons). Find the Xdebuger helper and click
options

In the Settings section at the bottom of the screen, enter phpDesigner2008 in the Xdebug.idekey
value. Ignore all the other setti
ngs it tells you to make to your php.ini file, these are not needed
for phpDesigner2008.

There are very brief instructions in this window on how to use the plugin. Take a few second to
read them then Click OK.

Close the Add
-
on dialog window. In the botto
m right corner of the screen in the status bar of
Firefox there is a small circle icon with an X through it. Click this until it is red (2 times).

This enables Xdebuger in firefox and initiates a debugging session. Open the script(s) to be
tested in phpDe
signer2008 and set whatever breakpoints/watches you want.

In Firefox, browse to the php page you are testing.
http://localhost/testfile.php
. Whenever your
script is called yo
u should see phpDesigneer2008's debugger working as normal.

Debug your script as you would normally. Output is fed to the running browser page.

Instructions for using any browser to initiate the debugging session


Open the script(s) to be tested in phpDe
signer2008 and set whatever breakpoints/watches you
want.

Open your browser and type the URL of the script you want to test and add the query
XDEBUG_SESSION_START=phpDesigner2008 to the end of the URL. Like this:
http://localhost/testfile.php?XDEBUG_SE

... signer2008

Whenever your script is called you should see phpDesigneer2008's debugger working as normal.

Debug your script as you would normally. Output

is fed to the running browser page.

That is pretty much it. So far this has worked for me. I have not done a great deal of testing so far
but what little I've done has worked perfectly.


Tutorial on how to configure Xdebug to work with
phpDesigner 2008

From MPSOFTWARE

With PHPD2008 comes a new set of features for Debugging scripts (not finding errors (PHPD
has have a live PHP check feature since PHPD2007), but running step by step to see why what
you want to show isn't and profiling (speed tests)).


They are really quite neat, but the only problem is, the php package with PHPD is not configured
for all sites. For example, any scripts with commands for mysql or mysqli will not work. And
when I tried to enable them myself from within the package, they w
ould not work.


So I tried a different approach. I used the files from my XAMPP setup, and now all features
work perfectly! Breakpoints, call stack, evaluate, watches, and context variables.


Contents

[
hide
]



1 Setup Xampp



2 Setup WinCacheGrind



3 Setup php.ini



4 Setup phpDeveloper 2008



5 You're Done

Setup Xampp

Note:

You can install anywhere on your system, but for this tutorial, I will use C:
\
xampp as the
installing directory, as its easier to type.



Install
XAMPP

to C:
\
xampp. If you want to run a web server, install the services. Its
recommended if you want to test your site locally.


Setup WinCacheGrind



Download
WinCacheGrind

and install into its default location

C:
\
Program Files
\
WinCacheGrind
\


Setup php.ini



Open

C:
\
xampp
\
php
\
php.ini in a text editor. Find

extension=php_xdebug.dll

in the file and make sure it is
commented out

(has a

; at the beginning of the line). If it isn't, it
will cause problems later.




In the same file, find the line

[Zend]

and

comment out all lines in that section with a single

; in front of each line. Xdebug cannot load
if zend is operational.




In the next section

[XDebug]

replace the entire section with the following:

[XDebug]

;; Only Zend OR (!) XDebug

zend_extension_ts="
\
xampp
\
php
\
ext
\
php_xdebug
-
2.0.0
-
5.2.2.dll"

xdebug.remote_enable=true

xdebug.remote_host=127.0.0.1

xdebug.remote_port=9000

xdebug.remote_handler=dbgp

xdebug.profiler_enable=1

xdebug.profiler_output_dir="
\
xampp
\
tmp"

(the dll name changes occasionally, so if
things aren't working, go to C:
\
xampp
\
php
\
ext
\

and look
for it, and copy its file name into the code above, replacing php_xdebug
-
2.0.0
-
5.2.2.dll then see
if things work better)




Save php.ini and close it.


Setup phpDeveloper 2008



Open PHPD2008, go to Tools > Preferences (or CTRL + E)




Go to the "Debugger" page, change your settings to the ones in this image:





Go to the "Profiler" page, change your settings to the ones in this image:





Go to the "Run" page, change your setting
s to the ones in this image:





Go to the "Localhost" page, change your settings to the ones in this image:



You're Done

If the configuration is done correctly, you're debug features should now be possible.


See my next tutorial on how to use these new features at:
Using XDebug on your scripts