Please License Your Code

I spent last weekend in sunny Miami, Florida - US at Sunshine PHP. As is my habit during PHP conferences, I recorded several episodes of Voices of the ElePHPant, including one marathon "It's the Booze Talking". During the latter half of the ITBT episode, a topic came up that I think is so important, I want to talk about it here. 

License your code!

It is wonderful that you have put your code up on GitHub. That is the essence of "Social Coding". However, if you do not put a license on it, you are just teasing developers. In essence, you are saying "See what I made? You can't use it, but I wanted to show you anyhow."

Granted, sometimes, developers will use unlicensed code in their projects anyhow, but usually not. Without a proper license, others have no idea what is a permissible use. You wrote it, you own it, you shared it, so let people know they can use it.


Github makes it easyGithub license selector showing some of the licenses available to developers

If you are sharing your code on Github, when you create your repo, Github offers to initialize your repo with a license. You can select from several different OSI Approved licenses. Github will then put the file in your repo for you so that others will know if they can use your code in their project.


The license is important

As the Templar told Indiana Jones in "The Last Crusade", "You must choose, but choose wisely". The license you choose will say a lot about your project. Some developers will like the license you choose, others will complain about it. Remember, you wrote the code, you hold the copyright, you get to pick the license and if others don't like it, they can use someone else's code.

If you aren't familiar with OSI approved licenses or want some help selecting one, visitChoose A License. It is EXACTLY what you think it is, a website that helps you make sense of the major licenses available to you. If none of the three on the homepage work for you, their "Featured Licenses" page gives you a quick overview of the major open sourcelicenses and adds on top of that "Public Domain". It is a quick and easy resource to use to pick the license best suited for your repo.


All repos are not created equal

Picking a license for your project doesn't mean that all your repos have to have the same license. It may be the case that you like a particular license and stick with it for all your code. However, different projects can have different needs. For some, the BSD license may be the way to go, for others, the GPL. For instance, if your repo is a WordPress plugin, then you have to license it as GPL to be included on 

No matter what license you choose, please do choose a license. It is more than just a trivial click of a button, it let's the rest of us know that you give us permission to use your code.