Welcome to ITP 405!

Hello everyone!

Welcome to ITP 405 - Advanced Back-End Web Development! In order for us to hit the ground running on the first day of class, I want to take care of most administrative items and development environment setup beforehand.

All course content will be on this site. Blackboard will only be used for grades and to access the Zoom meeting links for each class session. We will use the USC Viterbi School of Engineering Classes Slack workspace to communicate throughout the class. You should be automatically added to the spring21-itp-405-32074 channel once it is created by the school.

1. Object Oriented Programming (OOP) in PHP

Object Oriented Programming (OOP) is a large topic on its own, and there are classes at USC dedicated to it. In order to work with most frameworks out there, you need to know the basics of OOP. I will cover the basic mechanics of it so that you can work with Laravel, but I highly recommend spending some time reading about the subject and tinkering around. It will make you a better developer. I highly recommend going through at least one of the following resources, which I have put in order of preference:

  1. LinkedIn Learning - PHP: Object-Oriented Programming. All USC students should have access to LinkedIn Learning.
  2. Read Chapters 1 and 2 of PHP Object Oriented Solutions by David Powers. You can find a link to the ebook in the syllabus, available for free to all USC students. Although this book is old, these two chapters provide a great foundation of OOP in PHP.
  3. For a quick blog post, read Object-Oriented PHP for Beginners.

2. The Command Line Interface (CLI)

We will use the command line interface (CLI) in this class. Because I will be using a Mac, the CLI application that I will be using will be Terminal. If you're on Windows, check out the Learning Windows Terminal LinkedIn Learning course, which is available to all USC students.

If you're familiar with the Terminal and the following commands, feel free to skip this section.

  • pwd (Print Working Directory)
  • cd (Change Directory)
  • ls, ls -a, and ls -l (List files and folders)

A Note on Shells for Mac Users

If you're on a Mac, you may need to change the default shell. A shell is an environment in which we can run commands and programs. There are different flavors of a shell, just as there are different flavors of operating systems. Each flavor of shell has its own set of recognized commands and functions. The shells on a Mac include:

  • bash
  • zsh (oh my zsh)
  • ksh (KornShell)
  • csh (C shell)
  • tcsh (A decscendent of C shell)

The default shell on a Mac has been bash. When macOS Catalina was introduced, the default shell was changed to zsh. In this class, I am going to use bash. If you're familiar with the CLI and zsh, feel free to leave it. If you'd like to change your shell to bash, check out the following article, which will show you how to change your default shell via the Terminal or through System Preferences.

How to Change the Default Shell to Bash on macOS Catalina

Introduction to the CLI

The Terminal allows us to navigate our file system through commands as opposed to clicking on folders and files.

Open up your Terminal. If you type pwd and press return, you will see where you are currently at, referred to as the current working directory.

If you run ls, you will see the folders and files listed in the current working directory. If you run ls -a (the -a flag stands for "all"), the list will include all hidden files and folders. Hidden files on a Mac start with a period. If you run ls -l (the -l flag will list the files and folders in long format), you will get more information about the files and folders being listed. You can combine the -a and -l flags by running ls -al.

You can change directories using the cd command. For example, if there is a folder called "Music" in my current working directory, I can run cd Music. Now my current working directory is "Music". If I want to move up a folder, I can run cd ... The .. means "move up a folder".

I have also created a Command Line Basics resource that may help.

3. Editor and Database GUI

4. Create a Heroku Account

We will be using Heroku (the free tier) to deploy various projects. Please create an account.

5. Installing PHP

Installing PHP on Windows

If you're on Windows, check out Installing PHP on Windows. Be sure to install PHP 8.0.

Installing PHP on a Mac

We are going to install PHP via Homebrew, a package manager for macOS. If you don't have Homebrew installed, head over to the Homebrew site and follow the instructions on the homepage. Once you've installed Homebrew, you should have access to the brew command.

Now before you proceed to the next steps, if you have MAMP or XAMPP running, stop it. Now that you have Homebrew installed, run the following:

brew update
brew install php
brew services start php

If you get an error that says something like "Could Not Resolve HEAD to a Revision", try running git -C $(brew --repository homebrew/core) checkout master and then redo the above.

Restart Terminal. Run php -v from the command line. You should see an output similar to the following:

PHP version

The configuration files for PHP (php.ini and php-fpm.ini) can be found in /usr/local/etc/php/8.0/.

6. Installing Composer

Composer is a command line tool to install PHP libraries, which are usually referred to as packages.

Installing Composer on Windows

If you're on Windows, head over to https://getcomposer.org/doc/00-intro.md#installation-windows and follow the instructions.

Installing Composer on a Mac

If you're on a Mac, head over to https://getcomposer.org/download/ and follow the instructions.

Once you've done that, if you run ls, you should see a composer.phar file in the current working directory. Now run the following:

mv composer.phar /usr/local/bin/composer

Running Composer

Run composer from the command line. You should see an output similar to the following:

Composer

7. Git and GitHub

In this course, we will be using Git and GitHub for class demos and to turn in assignments, the midterm, the final project. Go ahead and do the following:

  • Create a GitHub account
  • Install Git
  • (Optional) I will be using Git from the CLI, but some students in the past have found the GitHub GUI to be helpful. This might be helpful for those who are less comfortable with the command line.

If you aren't familiar with Git and GitHub, you may want to check out the following course on LinkedIn Learning, which you should have access to as a USC student: Learning Git and GitHub.

I'd like you to be comfortable with the following git commands:

  • Creating a Git repository (git init)
  • git status
  • Staging files (git add)
  • Making commits (git commit)
  • Creating a repository on GitHub and pushing your local repository to your GitHub repository
  • .gitignore files

If you have any questions along the way, don't hesitate to reach out! Learning Git can feel pretty intimidating, but it is a crucial skill for a developer.

8. You're all set!

Please reach out to me on Slack if you have any questions. See everyone on Monday, January 25th at 5pm! 👩‍💻👨‍💻