Web
Article

An Introduction to Open-source Licenses

By Elio Qoshi

Choosing an open-source license

The web community is renowned for its willingness to share. Not only do we share experiences, give advice and help each other with projects, but we also share an incredible amount of code—from small snippets to entire frameworks and applications.

Much of the software we use daily is open-source—from operating systems and servers to the apps we use to ply our trades.

Amid all of this sharing, there arises the issue of copyright and licensing. If you're using someone else's free software, or if you're sharing your own work, it's important to consider these issues.

Standard Copyright

When you create a piece of software, it's automatically protected by copyright. This means that you retain all rights to your source code and that nobody else may reproduce, distribute, or create derivative works from your work.

It may also lead to no one using your code—which obviously defeats the purpose of sharing it.

So if you really do want to share your work, but also want to protect it in some way, it's important to consider the options available for licensing your work.

Choosing a License

There are various, recognized licenses you can apply to your work to make it really clear what people can do with your code. But each license has a particular focus, so which should you choose?

In this article, I'll briefly introduce several of the most used licenses. Which one you choose will depend on what you want to achieve and how your code should be distributed.

Disclaimer: the overview that follows only provides a general sense of what each license encompasses. To understand each license fully, you'll need to do more reading.

MIT License

mit

The MIT License lets people do anything they want with your code, as long as they provide attribution back to you and don't hold you liable if something goes wrong. It's used by projects like jQuery and Rails.

What's Required of You

You need to include a copyright notice, together with a copy of the license, within the code. (Just add a License file together with the ReadMe file.)

How You're Covered

The license states that the code is provided as is, and that you can't be held liable for damages.

Comments

This is probably the best option if you want to get your baby out and leave it to the interwebz.

Having said that, you should be ready to see your creation used elsewhere without the source available, meaning that you might be unable to apply the changes upstream (yes, basically someone can create proprietary software from your open-source software).

If you don't want others to have so much freedom to use your code, it might be better to consider another license.

Apache 2.0 License

apache

The Apache License is similar to the MIT License, but it also provides an express grant of patent rights from contributors to users.

It's much longer than the MIT license, mostly due to the grant of patent rights, but also because it explicitly disallows the use of trademarks in derivate works.

This license is used by—you guessed it—Apache, as well as Google (for its Android OS).

What's Required of You

Within the code, you need to include a copyright notice, together with a copy of the license. If you're creating a derivative work with significant changes to the code, these need to be indicated also.

How You're Covered

The code is provided as is and you, as the creator, can't be held liable for damages. Also, while this may be implicitly true of all licenses, the Apache license explicitly states that users of the software may not use the names, logos, or trademarks of contributors in their own derivative works.

Comments

Although a tad more restrictive than the MIT License, the Apache license makes it easier for the creator of the code to track changes—by requiring those creating derivatives to indicate significant changes to the code.

Still, remember that code licensed under the Apache License can end up in proprietary software.

GNU General Public License v3 (GPL3)

gpl

The GNU General Public License (or GPL for short) is a copyleft license.

Copyleft is a play on copyright, and applies to licenses that require copies and modified versions of the code to carry the same license conditions as the original. So, if you place a GPL license on your work, for example, you're asking those who distribute their own versions of your code to use the same license.

Placing a GPL license on your work means that, if someone takes your code and improves it, you can incorporate their changes back into your original project.

This license is used by the likes of Linux, Git and WordPress.

What's Required of You

You need to include a copyright notice, together with a copy of the license, within the code. You must also make the source code available when you release the software.

How You're Covered

The code is provided as is and you, as the creator, can't be held liable for damages. Users of your work can't grant a sublicense to modify and distribute the software to third parties not included in the license.

Comments

Basically, if your code is licensed under GPL, it's not allowed to be used in any proprietary software (except under certain special circumstances).

There's a lot you can find out about GPL, such as the differences between GPLv3 and GPLv2, and GPL's many variations—such as Affero General Public License, which covers things like Software as a Service (SaaS).

Other Licenses

other

Though the three licenses above are the ones you'll come across most—and the ones you're most likely to choose—there are many others. I'll briefly list just a few.

Artistic

Preferred by the Perl community among others, it bears some similarities with the MIT license but requires that modified versions of the software do not prevent users from running the standard version.

Also, while this may be implicitly true of all licenses, the Artistic license explicitly states that you may not use the names, logos, or trademarks of contributors (similar to the Apache License).

If you're creating a derivative work with significant changes to the code, these need to be indicated too.

Eclipse

The commercially-friendly copyleft Eclipse license provides the ability to commercially license binaries; a modern, royalty-free patent license grant; and the ability for linked works to use other licenses, including commercial ones.

The full source code needs to be disclosed when the software is published.

BSD

A permissive license that allows people to do anything with your code with proper attribution and without warranty.

Mozilla Public License (MPL)

MPL 2.0 is maintained by Mozilla. It attempts to be a compromise between the permissive BSD license and the reciprocal GPL license.

Creative Commons (CC)

Creative Commons provides a range of licenses for refining your copyright terms. With the CC0 license, for example, you can go the whole hog and relinquish all copyright claims, thus releasing your work entirely to the public domain. (Note, however, that CC recommends using licenses like MIT, Apache and GNU for software, because CC licenses don’t address the many issues related to code.)

Wrapping Up

Hopefully this brief overview has gotten you thinking about licenses and has answered a few of your questions about them.

There's a lot of reading you can do to find out about each license. But if that seems overwhelming, in most cases even the brief descriptions above can be enough to help you decide which license is right for you.

To finish up, here are some links for further reading:

Have you needed to choose a software license? Which one did you choose, and what determined your choice? Are you still confused about which license to choose for your project? Let us know in the comments.

Also, did you know that the SitePoint forums have a Showcase section where you're invited to share your code and talk about your open-source projects?

  • http://www.abdmaster.com/ Ahmedul Haque Abid

    Suppose I have a blog site where I share coding tips and scripts. Now:

    1. If I don’t place any copyright statement in the website, will a standard license still apply?
    2. If copyright statement is placed on site, but I still want to share code how would I do that?
    3. Is there any recommendation on which open source license to use for these kinds of sites?

    • Elio Qoshi

      1. You will own the full copyright unless stated otherwise. People won’t be able to use content created by you without your consent.
      2. Use one of the licenses introduced in this article. They work as additions to copyrights, not replacements.

      3.If you don’t care too much about restrictions to use your code, you should use the MIT license. If you don’t care at all about where your code ends up, even without giving you credit, but just want your code to be public domain, use CC0. GPL is perfect if you are aware of Free Software Philosophy, but you might want to avoid it if you are not sure what you’re doing. Having said that, you should read some stuff about licenses at one point or another.

    • http://timseverien.nl/ Tim Severien

      I think the answers provided by Elio are good, but I wanted to make an additional comment on question 2.

      You can publish contents and code with different licenses but you must explicitly mention the license for each.

      Copied from Paul Lewis’ blog:

      Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the Apache 2.0 License.

      • Elio Qoshi

        Good point Tim, thanks for reminding us :)

    • Mrinal

      Internet is itself like a GPL. I meant not literary. But in a way. When you write and publish something without view restriction it is understood that you want to share. People like us will follow things but people like unethical marketers don’t care. If you published it and people are viewing it, using it then it’s already started on being open-source.

      However, still no one is allowed to claim it as THEIR own content when you are author.

      If you are too worried, then you can put this CreativeCommons license. https://creativecommons.org/choose/ Free, Simple and amazing. Just generate for each article with URL, name and author. Then get the code and paste it using HTML.

      It will add up SEO value also as the post title is repeated in the text.

      Still, it won’t stop malicious people from copying as their own

      Nice article anyway. Good read. Thanks Elio.

  • Anitha Raj

    Nice post. Happened to learn some new things about open-source license. So thanks for sharing.

    http://www.itjobtrainingandplacement.in/courses/web-designing-training-in-chennai/

    • Elio Qoshi

      Thank you and welcome!

  • Gideon

    As the Apache License, The MIT in its X11 version add the following clause :

    “Except as contained in this notice, the name of the copyright holders shall not
    be used in advertising or otherwise to promote the sale, use or other dealings
    in this Software without prior written authorization from the copyright holders.”

  • Vasi

    Finally, I got this the right way. So much confusion. Any information about MySQL type of license? Thanks.

  • http://seoblogger-google.blogspot.com Syahran Syah

    Hi Elio Qoshi..thank you very much for share..really I like your post keep in touch from Indonesia.

    • Elio Qoshi

      Thank you!

  • Vasi

    Any information about MySQL type of license? Thanks.

    • Ralph Mason

      Did you see Elio’s answer above?

      • Vasi

        Maybe I’m blind but I don’t see it. :)

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Instant Website Review

Use Woorank to analyze and optimize your website to improve your website to improve your ranking!

Run a review to see how your site can improve across 70+ metrics!

Get the latest in Front-end, once a week, for free.