Slim Framework on Google App Engine

Today I launched my first production app on Google App Engine (GAE). I ran into a few headaches along the way, but thanks to the local dev tools, it wasn’t nearly as bad as it could have been.

The first headache was that one of the packages I was using utilized Guzzle 3 which requires the cURL extension. It’s not there. I had to fork and fix the package.

Here’s the tips I figured out for using the Slim Framework.

1. Add the following because Slim requires it without testing if it exists.

2. If you aren’t using your own log writer, the default one uses php://stderr. According to the GAE docs, it appears that this shouldn’t be a problem. Not so. I used the following dummy to just throw the messages through error_log(). Somewhere along my fruitless search for answers, I found out those don’t output to the same place.

With those two tweaks, Slim seems to be working well.

Downloading files from Google Cloud Storage using the PHP API

Downloading files was something else I was barely able to piece together. I found an outdated version, but the SDK had changed enough that it wasn’t operable.

If you’re doing this in a class or method and just want to pass $gcs, then you can get the client with using $gcs->getClient().



Google Cloud Storage PHP Client on a server

This example uses, PHP 5.4+ syntax. I used composer for loading up the client.

Access the Google Developers Console and go to the APIs & Auth > Credentials page. Click Create new Client ID and select Service Account. That will download a key file that we will need to put somewhere accessible by the script. I’m putting it in the same folder for this example, but you don’t want it downloadable. Next click Create new Key and select Server Key. The following constants are just straight copies from this page, except the project id, which is found as the Project Number on the Overview page.

The second parameter of Google_Auth_AssertionCredentials constructor is an array of services/APIs that you want to access. All the examples I found listed URLS, but I found that they are usually a constant on each service’s class.

Things that irritate me on Google+

  1. Profile shortnames didn’t migrate. So instead of, I’m stuck with Yes, there are work arounds and you can use DNS forwarding and shorteners. I just don’t get why they would take a step backwards from something they already were doing right in Google Profiles. Remember the mess when they rolled out names on Facebook late in the game?
  2. Comments on active posts make a page really long and there’s no way to shorten it except a full page refresh.
  3. There’s no way to find the +replies easily. At least not that I saw.
  4. YouTube posts are really big. It would be better if there was just a small thumbnail and clicking it would expand like the photos do.
  5. It’s missing a way to DM smoothly. Yes you can Share with just a single person, but that seems hokey. Since this is Google “plus”, maybe a simple way to email other users. I don’t think we need new functionality, isn’t that the idea behind plus, to augment what already exists?
Other than those issues, I’m really enjoying it so far. Circles makes sense to me and setting sharing permissions is just easier than on FaceBook. I can’t wait till I have more friends on it to see how the experience changes.

Uploading an existing project to Chaw using git

This is for users of It is a project repository for CakePHP projects.

Change directory to your application’s working path. This will be inside of your “app” directory.
cd /htdocs/app

Setup git locally.
git init

Add link to the remote repository.
git remote add upstream [email protected]:projectname.git

Edit .gitignore to include the following:

*Note for Mac users, it is advantageous to also add .DS_Store

This is HIGHLY recommended. This prints out a list of files that would be added, so you can make sure there aren’t extra libraries or other files
git add . --dry-run

Add files to commit.
git add .

Commit files.
git commit -m "Initial commit of project files"

Upload to the repository.
git pull upstream master
git push upstream master

Generating CakePHP API for local use on OS X

1) Download the Mac disk image of Doxygen and install the application.

2) Download my Doxygen config file. Adapted from Ticket #5910.

3) Create a directory in your app/webroot/ named api.

4) Open Doxygen and open the config file.

5) Double check that Source code directory and Destination directory are correct for your setup.

6) Switch to the Run tab and hit run.

That’s it!