Enter your Sign on user name and password.

Forgot password?
  • Follow us on:
Loading video...
Lecture Comments (1)

0 answers

Post by Shachar A on December 18, 2013

how can I download phpDocumentor? I went to the site but it is compilicated , farther more , I have php 3.3 and I want to update, is there a simple way to do it?

Advanced Course Development Environment

  • This course will use the same local development environment setup as the 'Introduction to PHP' course at educator.com. Lecture #3 and lecture #28 in the introductory course contain the information on how to configure your development environment.
  • Course software download links:
  • The code for the course is divided into three directories: 'homework_solutions', 'lecture_examples, & 'web_app'.
  • The 'web_app' directory contains a file called 'changelog.html' that outlines all of the changes made to the Educator Store web application from version to version.
  • Documentation for each version of the web application will be generated using the phpDocumentor software package. The generated documentation for a particular version of the application can be found in the docs subdirectory of that version's main directory.
  • More information about using phpDocumentor can be found at the project's homepage at:
  • For previous Educator PHP students, the following updates were made to the final version of the introductory course's web application:
    • The lib directory was moved into the includes directory.
    • The images directory was moved back into each version’s directory.
    • The VERSION constant has been removed from ‘config.php’, and each web application version’s URIs are now dynamically generated in 'config.php'.

Advanced Course Development Environment

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

Transcription: Advanced Course Development Environment

Hello again, and welcome back to Educator.com's Advanced PHP with MySQL course.0000

In today's lesson, we are going to be discussing the details of the advanced course's development environment.0005

Specifically, we are going to be going over what the setup of our development environment for this course is going to be.0013

And then, we are going to go over what directory structure the files we are going to be using in this course are going to follow--0019

for example, how the web application directories are going to be organized; 0027

how the lecture examples and homework solution directories are going to be organized.0032

We are also going to talk about some software written in PHP called PHP Documentor,0036

which is something that we are going to be using in this course to document 0042

all of the web application function files and class files that we are going to be developing.0046

And we are going to explain a little bit about what that is and what that documentation looks like.0052

We are also going to have a quick note for previous Educator.com PHP students who have taken the introductory course,0058

to just mention some slight changes that have been made to the Educator Store web application 0064

from the end of the introductory lesson and to the beginning of this advanced lesson.0070

And then, we are going to introduce our first homework challenge for this course.0074

And homework challenges (for those students new to Educator.com, are challenges that are provided at the end of many different lessons0078

to give you extra activity to work on, so that you can reinforce and learn some of the concepts that we went over in a particular lesson.0088

The development environment setup we are going to be using for this course is the same that we used in the Introduction to PHP course.0098

And that is comprised of a couple different pieces of software--specifically the Firefox web browser (that is the web browser0106

we are going to be using for our development).0113

We are also going to be using the XAMPP for Windows software distribution.0115

And for those of you new to Educator, the XAMPP software distribution is a software package that bundles PHP along with0120

the Apache web server, and makes the installation and configuration of those two easy.0128

And in addition, it also provides the MySQL database.0133

And because in this advanced course, we are going to be dealing with the MySQL database, 0136

we are going to take advantage of that piece of software that is added to the distribution, as well.0140

Additionally, we are going to be editing our text files and doing our code development in the PSPAD text editor for Windows.0145

If we go and look at our web browser, you can see that Mozilla is the maker of the Firefox web browser, 0153

so this is the page that you will go to to download the Firefox software.0162

And all of these links are available in the introductory lesson.0166

This website, called apachefriends.org, is the maker of the XAMPP for Windows software distribution.0172

And this website tells a little bit about the different versions of the software (for example, Apache, PHP, and MySQL)0178

that are included in the distribution we are going to be using.0184

And then, pspad.com is where you can download the text editor that we are going to be using.0187

Additionally, we are also going to be using the Firebug add-on to Firefox, which is a web development tool0195

that you can add on to Firefox to help you when working with web applications and diagnosing different problems.0203

And if I click on this (it's already installed) little bug down here at the bottom of the screen, you can see the Firebug add-on pop up.0209

We will be working with that in this course--specifically when we are learning about HTTP and how that works.0216

In lecture 3 of the introductory course, that contains all of the instructions 0228

for setting up the development environment we are going to be using in this course.0231

So, for those of you that are new to Educator.com, I encourage you to go check out lecture 3 to find out how to set up the environment.0234

It walks through all of the different steps to get things up and running.0241

And what that is going to allow you to do is to hopefully be able to mimic the things that we do here in the lectures on your own home computer.0246

Additionally, there is lecture 28, titled Sending Email using PHP, that is part of that introductory course.0254

And that also makes some configuration changes to the development environment that allow you to send email from your PHP code.0261

And we use that in our Educator Store web application.0270

As far as the course goes, the course examples (the web application, the lecture examples, 0278

and the homework solutions) are all going to be combined into a particular directory structure.0288

And when you go to the Advanced PHP course's website, you will be able to download a ZIP file0293

that contains all of the homework examples, lecture examples, and versions of the web application.0298

What I am going to do now is just go over the structure of that ZIP file and how these files are going to be structured0305

within our web tree, or the document root of our Apache server.0313

The first thing is: we are going to be creating a file called advanced_php in the document root of Apache.0317

If we go to that, I have already gone in and unzipped this file that you are going to be able to get on the website.0325

And if you look in XAMPP, if you go to the XAMPP installation directory, there is an htdocs folder,0332

which is the document root of the Apache web server, bundled with XAMPP.0342

And we have an advanced_php folder.0346

Now, within that folder, there are going to be three different folders: one that is homework_solutions,0349

which has a folder for each lecture that has a homework challenge and provides a solution for it.0354

There is also a lecture_examples folder, which provides copies of all the examples that we run as we go through the lectures in the course.0361

And probably most interesting is the web_app folder: and what that does is contains all of the different versions of the Educator Store0371

web application that we are going to be developing and building on as we go throughout this advanced course.0377

For each version of the web app, there will be a separate folder that is going to contain all of the files for that particular version of the web application.0383

Here, you can see, we have version 0.0; and what that is: that is the baseline web app that we are going to start from.0390

Because we had already been developing this web app in the introductory course, we are going to baseline the app with version 0.0.0397

We are going to say, "This is where we are going to start from, and this is the version that we are going to add onto as we add new concepts in this course."0404

Additionally, there is also going to be a file called change_log.html within this web app folder.0413

What that is going to do is be an HTML file you can view in your browser that is going to allow you to see all of the different changes0419

that were made when going from one version to the next.0426

So, it will help you when looking at the different versions of the web app.0429

Rather than just looking at the source code to see the changes, you will be able to go to change_log.html and see any specific changes that were made.0433

As mentioned, what we are going to be using for this course, or at least the code that we are going to be including in the ZIP file0446

that you can download for this course, is going to be documented using a tool known as PHP Documentor.0453

And what it is: it is a tool that is used to automatically generate code documentation.0460

The way it works is: it parses source code files and looks for particular things known as tags and formatting structures that you add as a programmer.0465

And then, from those, you can generate documentation.0475

And if you take a look at, for example, outputLIB.php, which is our output function library,0479

and we look at the outputHtmlTag function, we can see that the documentation for this particular function has some strange tags in it.0487

And what they are, are ways to describe to the PHP Documentor tool information about the particular function.0499

For example, the @param tag is used to describe to the PHP Documentor all of the different parameters that a particular function takes.0506

The @return tag is used to describe the data type of the return value and what the return value represents.0516

There are a bunch of different other tags that we can use.0526

For example, here, this is an in-line source tag, which outputs in the documentation all of the source code for a particular function.0529

What happens is: PHP Documentor goes through and parses over all of these source code files and generates documentation.0539

Now, for this course, we are not going to be teaching how to use the PHP Documentor software.0549

But it is an extremely useful tool for generating documentation, and it is going to make it easier for me to explain0556

the different concepts that we will be learning throughout the course, and to look at the different source code,0563

because it formats source code in a nice, pretty format, and it is going to make it easier to describe things.0567

It is something that Educator will be doing on the back end; and with each version of the web application that we create,0574

and that we are going to include in the ZIP file you can download, there is going to be documentation generated for that particular version.0583

And it is going to be contained in the docs folder for each version of the web application folder.0590

For example, if we go to the advanced_php folder, and go to the web app directory, and we look at (for example) version 0.0,0598

we will see that there is a docs folder.0606

And it has an index.html file, which you can browse to, that is going to show documentation for all of the different functions,0608

and when we learn about objects and classes, all of the classes that are used in that particular version of the web application.0615

If we go...I'm going to go and show you what the documentation looks like.0622

For example, if we go to version 0.0 (and this is just browsing to this file in our web browser), and we go to docs, it automatically loads index.html.0628

And what you can see is: it has a rather nicely-formatted website, and it provides information 0639

about all the functions that we use in this version 0.0 of the web app.0646

For example, you can categorize the functions into different groups.0652

For example, I have categorized all of the output functions that are contained in outputLIB.php into an output category.0656

And it lists here all of the different functions that are defined in this outputLIB.php.0663

So, for example, if we click on the link outputHtmlTag, we can see the documentation that PHP Documentor has created for this particular function.0669

And what it did was: it went through and parsed this source code file that we have (and we talked about the different0680

tags that it looked for) and generates this documentation.0685

We can see, it has a statement about what the function does.0690

It returns a well-formed HTML tag, including any provided tag attributes and/or tag body.0693

It provides a little additional information that we can include to describe what the function does.0700

Here, we can see, it outputs the source code of that particular function.0705

And this is going to be useful to us, because when we are going over and explaining how the different versions of the web app work,0709

we are typically going to be using the documentation to look at the source code, because, as you can see,0715

it formats the code in a rather nice way; it does syntax highlighting, so that you can see things and make things clearer.0723

Additionally, it also has links to different functions.0732

For example, the one thing that the code automatically does is: if you use, for example, the is_string function0737

within one of your methods, you can click on it, and it will automatically link to that function's reference at php.net.0745

For example, if I click on is_string, it (and this is a little bit) goes to the php.net website and shows you the documentation for is_string.0752

And that is really quite a useful feature.0763

The other thing that it will allow you to do is (for example): down here, in the outputImg function,0766

when we look at the source code for it, we can see that it also calls the outputHtmlTag.0770

And if you will notice, outputHtmlTag is actually a link, and if we click on it, it goes and links to the outputHtmlTag's documentation.0777

So, it really is a convenient way to browse the documentation for different functions.0784

It enables you to figure out how the different functions work together, and how they are connected.0789

One other thing to note is that, if you want to look at the source code for a particular file...for example, if we want to look0796

at the source code for all of the output functions in outputLIB.php, if we click on outputLIB.php, it brings us to this page.0802

We can click on the link on the top that says Source Code for this File, and what it does is contains all of the source code that is contained in that file.0812

And this, again, shows it formatted in a nice way.0820

You can see here the different PHP Documentor tags, but you can also see all of the code that you have written.0823

We are going to be using that to look through the code as we work throughout the course.0829

If you want to find out more information about using PHP Documentor, and if you want to use that in your own code0834

(and I highly recommend it--it is a very useful tool), you can find information about that at phpdoc.org.0839

And one of the ways you can learn about how to use it is seeing the different tags that we used within our source code files for the course.0846

Now, I just wanted to briefly mention a couple of things for those students that are previous Educator PHP students that have taken the introductory course.0856

In addition to adding these PHP Documentor tags to all of our source code files, that allow us to create this documentation,0865

there have been a couple of other changes that have been made to the final version of that introductory web app.0874

A couple of things to note are that the LIB directory, where we contain our function libraries, has been moved to the Includes directory...0879

Before, LIB and Includes were two separate directories in the root directory of the web app version.0888

Now, the LIB directory is contained in the Includes directory.0894

Additionally, we have also moved the Images directory back into each version of the web app.0898

For example, each version of the web app...if we go to version 1.0, it has its own Images directory.0904

If we go to version 1.1, it has its own Images directory.0912

We had, in the introductory course, moved that out of that directory to demonstrate working with constants0918

and being able to change the location of an image directory and have your application still work.0924

But we did that to emphasize a point, but now we are going to use the Images directory in a more real-world application,0931

where it would actually be in the root directory of the web application.0937

Additionally, in our configuration file, config.php, we have gotten rid of the version constant.0941

And what we have done now is generated all of the URI's and paths that we use in our config file (for example) to load libraries and to load include files.0947

We are going to generate the URI's dynamically.0961

So, if we look at the old version of config.php, we can see we had a version constant.0964

And for each version of the web app, we would have to come in and update this version number.0971

And as you can see here, we used this constant to define the path to our particular version of the web application.0976

Now, what we have done is removed that constant and generated this root URI, which is the path we use to define (for example)0986

where our images are located in IMAGE_DIR, as well as where our Includes directory and our LIB directory are, and so forth.0998

We generate that dynamically, and we do that using the magic constant __FILE__, and then also using our SERVER ['DOCUMENT_ROOT'].1006

So, there is a little bit of code here at the beginning that will automatically generate that.1013

What that is going to do is: now, every time we update the version of the web application, we don't have to go and update that version constant anymore.1016

And finally, another thing that we have done is just updated some of the comments.1025

There were some comments that noted specific version numbers in the introductory course.1030

For example, there might be a comment that said, "This function was added in version 16.0."1034

Well, 16.0 is not relevant in this advanced course; it's version 16.0 in the introductory course.1038

So, we have gone ahead and removed those version numbers from our comments.1045

For the homework challenge for today, I would just like you to look through the web application source code1053

to make sure you understand how our web application is functioning.1058

You can go through version 0.0, play around with the code, and play around with the website to see how it works.1061

Additionally, I think it would be a good idea if you looked through the documentation that has been generated1069

by PHP Documentor for version 0.0, which is our baseline version for this course,1074

so you can get a feel for what the documentation looks like and how to use it, and how you can link, for example, from function to function:1081

how you can click on a link to go to the php.net website.1088

And it will just give you some experience, getting familiar with what that documentation looks like,1091

because we are going to be looking at that documentation a lot throughout the course.1095

Finally, for students that are new to Educator.com, I would like you to go ahead and (if you need to)1100

review lecture 3 and lecture 28 from the introductory course, to find out what you need to do 1106

to get your development environment set up on your computer, 1113

so that you can mimic the things that we do here in the lectures on your home computer.1116

That ends today's lesson; thank you for watching Educator.com, and I look forward to seeing you next time.1122