Link Post: Introducing the Symfony Demo application

I’ve been working with Symfony for a couple projects and I’ve been super happy with the documentation. It seems like every time I do a search for something that I’m stuck on the project has already had a piece of documentation. It’s nice to see they have this cool demo application that’s using their best practices. It’s super basic but it’s a nice reference.

Creating a Custom Fork of a Composer Library

Composer is great because you can easily add libraries to your projects and have it automatically pull down the same versions for every deploy of your site. The downside to composer libraries (and open source in general), is that sometimes it’s hard to get your pull requests for bug fixes merged into the master so you can use it on your project or add your own customizations. You can fork the repository in order to gain more control over the source.


The first step is that you need to fork the library you need to make changes to.

On the project’s GitHub repo there’s a fork button in the upper right hand corner of the screen.
Screen Shot 2015-04-24 at 11.16.22 AM

If you press this button GitHub will ask you where you want to fork the repo. We’re going to use the TPT organization but you can fork it to your personal repo if you’re the only one using it.

Screen Shot 2015-04-24 at 11.16.34 AM

Wait for GitHub to do it’s magic.

Screen Shot 2015-04-24 at 11.16.39 AM

After this process has completed, you’ll be brought to the homepage of your new repo. The thing I really like about Forks on GitHub is that it lists the original repo it was forked from.

Screen Shot 2015-04-24 at 11.16.47 AM

Edit the libraries composer.json

The first step to getting this library ready to be used is we need to change the name of the project in the composer.json for the repo we just cloned.

The first line will look similar to this:

"name": "squizlabs/php_codesniffer"

We need to change it to our new repo location (see this commit):

"name": "thisprogrammingthing/php_codesniffer"

If you don’t make this change, composer won’t see this as a valid package because the names won’t match.

At this point you can make any other changes that you need to this library.

Loading your fork using composer

Now that we have a custom version of the library we can load it into our project. The first step is to make some changes to the composer.json file for the project it’s going to be used in:


    "require": {
        "squizlabs/php_codesniffer": "*"


    "repositories": [
            "type": "git",
            "url":  ""
    "require": {
        "thisprogrammingthing/php_codesniffer": "dev-master"

This is an SUPER simple composer.json but the important points are:

  1. We added a repositories key to our JSON file that includes where to find our custom library.
  2. We changed the organization field to our custom libraries path.
  3. We switch to using dev-master. This is so we don’t have to tag “releases” (I’ve found this to be overkill in most cases).

Now we just need to update our project so it uses our version of the library

$ composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)                           
  - Removing squizlabs/php_codesniffer (2.3.0)
  - Installing thisprogrammingthing/php_codesniffer (2.3.1)
    Cloning 8104697c26152935642da5413e970ffa1725e2ee

Writing lock file
Generating autoload files

The downsides

This process isn’t without it’s downsides. Yes, it’s cool to have a copy of a library but now you have a version of a library that you have to patch every so often. I recommend doing this ONLY if you can’t find another way around having a fork or if you don’t care about not having the latest security and bug fixes (which you should).

GitHub QuickTip: Adding a Folder From the Web Interface

I needed to add a file to a directory that didn’t exist using the GitHub web interface (I didn’t want to clone the repo [lazy I know]). If you add a new file and then type the name of the directory and then the forward slash (/) it will automatically create the folder:
Screen Shot 2015-04-24 at 11.21.55 AM

Screen Shot 2015-04-24 at 11.21.59 AM

Cool trick for the two times a year I need to make changes directly on the GitHub site. ;-)

ERROR 1221 (HY000) While Revoking Super

I’ve been working with MySQL Master-Slave replication at work a LOT recently and one of the things that you have to do on read-only slaves is to revoke the super access to the user access the slave so it doesn’t write data.

I normally setup users like this because it’s easy and it gives the user all the access they need:

mysql> grant all on tasks.* to 'taskuser'@'localhost';

So when I tried to revote super I got the following error:

mysql> revoke SUPER on tasks.* from 'taskuser'@'localhost'; 
ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES 

The super permission can’t be revoted on a specific database it has to be revoted on ALL databases:

mysql> revoke super on *.* from 'taskuser'@'localhost';

Again another hour of my life that can’t be returned. :-)