CICON2010: Joel Gascoigne - CodeIgniter for Startups


Published on

Joel runs his own startup, OnePage, a site dedicated to giving out interactive contact cards. He shows how he has used CodeIgniter in his startup OnePage to formulate ideas into reality and continually improve your ideas to form a business model.

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Hi everyone, I’m really excited to be here. I’m Joel Gascoigne and I run a startup called OnePage. I want to share with you how I’ve been using CodeIgniter as the framework to build OnePage.
  • So how did I end up in front of you guys talking about CodeIgniter for Startups?

    Like a lot of you guys I’m guessing, I started playing around with code when I was around 12 or 13, and I built my first website commercially when I was 15. It was a great feeling to discover I could make money doing what I considered a hobby!

    So I’ve been coding for around 10 years now and that has primarily been within CodeIgniter for the last 3 years.

    I went to the University of Warwick and studied Computing Systems and it was during my time working on several university projects that my thinking shifted from wanting to become a freelance developer to a strong desire to create an Internet Startup.

    So that’s what I’m doing. I’m the Founder of a startup called OnePage. OnePage is your business card ‘in the cloud’, so you never run out of business cards and you can push changes to your contact details to your contacts instantly.

    Since I’ve got into startups I’ve become pretty active in the startup scene and I make it to lots of the startup events in London and elsewhere, and at the start of the year I started running an event called StartupMill to encourage startups throughout the UK. There are currently events in Sheffield, Manchester and Birmingham. Chat to me afterwards if you’re interested in any of those events!
  • And here’s my OnePage. This is what you can get for yourself if you go along to, it only takes a minute and you can sign up with Twitter, LinkedIn or Facebook.

    Mobile apps are on the way.
  • Anyway, enough about me (I had to go for a bit of a plug didn’t I really!)

    Just in case you get bored, here’s what I’m going to be chatting about so you’ll know how much more of me you have to sit through :)

    I’m going to start by talking about some of the startup methodologies and techniques I’ve discovered throughout my reading.

    I’ll then talk about how we can apply some of those techniques within CodeIgniter, and I’ll show you a few examples of how that is happening within OnePage.

    Finally, what I want to finish with is to hopefully spark off an idea I have for how we could collectively make creating startups a much more successful process by collaborating.
  • As I mentioned, whilst at University I worked on a number of projects and one of the main reasons I got hooked on the idea of creating a startup was as a result of the experiences I had during these projects.

    My Masters Dissertation project in 08 to 09 was a location based social network I build with 4 other Computer Science classmates. It had a web app and a mobile app and it was working nicely and was getting some decent usage within the Warwick campus. This was before Foursquare, Gowalla and Latitude existed. I was keen to continue it but my classmates were not as startup-minded as me and it did not work out. However, since then I’ve been determined to create a successful Internet startup because I know how big that could have been.

    After I made my decision to pursue startups, I started reading a lot.
  • So a lot of my time in the past year has been in reading up on other peoples’ experiences as well as actually implementing a startup.

    I’m going to talk about some of the key people amongst all my reading which have been the people defining my thinking.

    I’ll then summarise the key learnings I have come away with from all the reading, watching and listening I have done.

    Finally, I’ll detail some of the specific techniques which make sense for startups and are recommended by these people. This will lead us nicely into the second half of my talk where I’ll work through many of the techniques and show you how they can be applied in CodeIgniter.
  • Right now is a fantastic time to do an Internet startup as there is so much information out there to learn from. Unlike a few years ago, there are now many success stories from people who have made it through the whole process and are much better off as a result.

    I’ve managed to break all this information down to 4 people who have really shaped my mindset in the last couple of years.
  • Eric Ries is a serial entrepreneur and a venture advisor sitting on the board of a number of companies including PBWorks. He now spends a lot of his time talking at various events about what he calls the “Lean Startup”.

    Eric uses the term “Lean Startup” for a new breed of startups which has been made possible by the following things recently.

    Firstly, the use of open source and free software. We’re all familiar with this since CodeIgniter itself is open source. This also includes all the cloud based services out there which let you outsource parts of your startup which are not the core business elements.

    Secondly, lean startups use agile development methodologies which have proven to be very successful in large companies building substantial applications.

    Finally, lean startups iterate rapidly based on customer feedback and insights.

    These are the 3 enablers of lean startups and the result is reduced cost and reduced time to deploy applications. Many say what cost millions in the dot com era around 2000 now costs thousands, and I believe I am showing that it can cost much less than that too. It really is a good time.

  • One of the things Eric talks about is what he calls the “pivot”.

    He defines the “pivot” as an act which happens in a startup when they realise that the initial idea is not working as well as the founders expected it would. They then make a decision to pivot the business - i.e. change part of it significantly whilst still staying in line with the core business vision. Therefore it makes sense to strive to succeed as a business rather than with a specific idea and be comfortable with changing the business if needed.

    There are a number of great examples of businesses pivoting and it shows that the basis of a great business does not have to be an initial great idea, and that in fact the initial idea is of little significant as long as the founders have the tenacity to succeed and the open-mindedness to change their path if they need to in order to reach their targets.

    Did you know that Flickr start out as an online game? It’s just that the photo management aspects of the game were getting the most use and the founders were clever enough to realise that that portion of the application was strong enough to stand on its own.

    I’ve personally experienced this directly as OnePage has already pivoted once. Some of you might not be aware that OnePage started out as a lifestream application which aggregated all your streams from various social networks and services. Little of that remains now, and it was an important decision to drop the stream aspect of the application.
  • Eric always describes the lean startup by describing other methodologies and always starts with the waterfall methodology.

    Out of interest, who is familiar with waterfall methodology?


    As I’m sure most of you are aware, the waterfall methodology is almost always a very bad methodology for software development projects. The reason is that it involves a lot of time getting everything right before you start and therefore changes later in the process are very expensive. The statistics are actually very bad, maybe worse than you might think. Apparently around ~6/10 never actually finish, that is that 4/10 finish and only a small amount of those are actually successful in terms of making profit.

    However, waterfall works well for specific projects (e.g. adapting something you have built in the past) - i.e. when the Problem and Solution is known.

    The nature of waterfall means that the stages are supposed to happen in a linear fashion where perhaps they would be suited to being done in parallel, and therefore it is hard to keep the stages in sync.

    Also, batch size tends to grow, and larger batch sizes are harder to manage.

    The unit of progress here is advancing to the next stage, and therefore it can potentially be easy to get caught up with “moving the project forward” without paying enough attention to whether what you are developing is something that users want.
  • So agile is a better way to go.

    This is one particular agile methodology called Extreme Programming.

    How many of you are familiar with agile methodologies?

    Cool, so what we find is that building the solution in an iterative way increases the odds that it will be successful.

    The thing about agile is that it is built for when the problem is known and the solution is unknown (e.g. Payroll System).

    One of the techniques is to sit a customer beside the developers whilst working, so the feedback is greatly increased.

    In agile software development methodologies the unit of progress becomes “a line of working code”. We will stop writing buggy code.

    It is a very effective paradigm for IT shops in big companies.
  • However, with startups we live in a world of unknown problems and unknown solutions. In other words, we don’t know what we don’t know and we have no idea whether users or customers will want what we think they will want. In reality our idea is simply a hypothesis and must be tested.

    So the idea for the lean startup methodology is to avoid spending time and money without knowing if we are making progress, since the biggest form of waste in startups is building something nobody wants.

    What counts? Validated learning, for example with metrics such as activity on the web app or even better, revenue.

    In order to speed up the learning, we need to reduce the size of the batches in order to move more rapidly through the feedback loop.

    The unit of progress becomes validated learning about customers.
  • So a simplified diagram of Eric Ries’ lean startup would be this.

    Back to the definition of a pivot, this diagram is nice because a pivot is one full iteration of this loop.

    Pivots could be small changes based on feedback or big changes taking the project in a completely new direction.
  • And there are quite a number of techniques involved, some of which I will be going through in more detail shortly.
  • I highly recommend either reading Eric’s blog at, or if you haven’t come across his work already then I’d recommend grabbing his new book which is a compilation of his many useful blog posts.
  • The second person who has greatly influenced my thinking is Steve Blank. Steve is also a serial entrepreneur, he has built around 8 high tech companies and he is now in academia at Stanford.

    Steve has been a big influence on Eric Ries and you can see here that this diagram is the addition Eric made to the agile methodology to create the lean startup.

    The emphasis Steve Blank has had on me is to “get out of the building”, in other words to actually talk to people and discover what they want and where the startup needs to be taken. This is what he calls the “Search for a business” and is part of the two of his “four steps” called Customer Discovery and Customer Validation. The other two steps are for the growth of the business after what is called “Product/Market Fit” has been reached. For the startup stage we’re more interested in the steps on the left here.
  • I highly recommend Steve Blank’s book called quite appropriately Four Steps to the Epiphany. I have only glanced through it and I will say this is not your typical business book, it is very much a book as you would expect it to be written by an academic. It is very informative but quite a hard read.

    What I have read recently is a book called The Entrepreneur’s Guide to Customer Development and this book has distilled all the components of Steve Blank’s work and has created a very readable and useful book, and it even has a foreword by Steve Blank himself. This was very useful for me.
  • We just mentioned the point at which the work in a startup changes from searching for a business model to executing a plan which is validated, and that point is referred to as “Product/Market Fit”.

    The person who has really pioneered this part of startups is a guy called Sean Ellis. Sean has worked on many startups and has done a lot of research into startups. He’s worked with people such as Dropbox.

    What Sean has found is that comparing results across over 100 startups, those that struggle have not reached “Product/Market Fit”. Now, for quite some time this idea of “Product/Market Fit” was quite vague and abstract, but recently Sean found a way to define it and has come up with a set of questions in a survey to determine whether Product/Market fit has been reached.

    He defines Product/Market Fit as when after surveying existing customers, 40% say that they would be very disappointed if they could no longer use the product. This is when the product is seen as a “must have” rather than a “nice to have”.

    I’ve recently done this with OnePage and I know I have some work to do to reach this stage. It is nice to have done it and kind of put a stake in the ground at this point. It is very easy to measure this and I will do it again in the future after a few more iterations and I’m confident I’ll reach it.
  • In this pyramid, the bottom level is Product/Market fit, and the conclusion is that unless Product/Market Fit has been reached it is a bad idea to progress through your startup.
  • It’s really interesting stuff, so check out Sean Ellis’ website at
  • Right, the final guy who’s been a really big inspiration and has helped me focus is Dave McClure. I’m never going to be able to match his presentation style and I won’t even try to, but you really need to see him present his “Startup Metrics for Pirates” talk so make sure you look it up.

    Dave McClure brings the importance of metrics to startups.

    He talks about 5 key metrics for any startup, and here they are:

    Acquisition is how you get customers to your website. In OnePage I define acquisition as someone hitting the landing page and then signing up, i.e. giving me their email. I then consider them acquired.

    Activation is the user having a good first experience. For OnePage, this is that they put their name in, upload a profile picture and add at least a couple of contact points.

    Retention is how many users come back to the website on a regular basis. It is obvious that Twitter and Facebook have ridiculously high retention rates for the people who do use those services.

    Referral is the act of someone referring someone else to the app, and this feeds back into acquisition. For OnePage, since it is your business card and it is all about sharing that with people, referral is one of the key ones.

    Revenue really is the best metric for measuring success, and that can be seen as the final step if you see these metrics as a funnel.

    Obviously, the initials of these metrics spell out AARRR, hence pirate metrics :)
  • Dave McClure has an interesting style of slides, but this is his slide for detailing all the methods for the 5 metrics. It’s actually an amazingly informative slide, I point people to it a lot.
  • One thing people have started doing is using what Dave calls a Conversion Dashboard, and it is a table something like this detailing the key actions for users for the various metrics. What can then be done is the conversion percentages can be tracked through the system and the estimated value of each step can be traced through the app until the final goal of revenue.

    I am actually trying to change my administration panel to reflect this as I think it is really powerful.

    The thing about metrics is that in a world of Google Analytics it is easy to get overwhelmed by the amount of metrics out there but what I love about Dave McClure’s Pirate Metrics is that it really focuses on what is important. There’s an important difference between vanity metrics and actionable metrics.
  • For more from Dave McClure check out his blog at, and like I said be sure to hear the information from himself as it is certainly an exerience.
  • Right. I’ve very rapidly been through a lot of information there, so let’s try and reflect on what the key learning is.

    Firstly, it’s important that we have a culture of embracing change and avoiding assumptions. Testing assumptions is key here.

    We can learn from Eric Ries the idea of the Pivot and the importance of rapidly iterating through the feedback loop to learn from customers.

    We can lern from Steve Blank how important it is to actually get out of the building, away from the tech and validating our hypotheses.

    Sean Ellis has taught us to concentrate on nothing other than reaching Product/Market Fit before we advance to further steps of our startup.

    Finally, in order to test our assumptions and not base our decisions on opinion, we can use the 5 metrics Dave McClure talks about.
  • Right, if we go back to the lean startup feedback loop that has been pioneered by Eric Ries, we can see that there are a number of key techniques for this new breed of startups.

    There are a lot of them, and I’m limited for time here so I’m going to go through a few of them, and then later in my talk I’ll be going through the specifics of how to apply them within CodeIgniter.
  • So the 4 techniques I’m quickly going to describe are these.

    Testing takes place at the build stage in order to consistently build bug-free code and ensure that rather than the usual trend of software becoming less reliable as time goes on, it can have a higher quality.

    Cloud computing is as I’ve mentioned, the act of using cloud based services to focus on our core business competencies and outsource other aspects in order to speed up our time to deployment.

    Split tests are a great way to base changes on fact rather than opinion,

    and continuous deployment is a way to deploy code rapidly in order to achieve the fastest possible cycle time through the loop.
  • Out of interest, who has come across Unit testing and Acceptance testing before?

    OK, cool.

    Unit testing is testing the core functions in your code. The idea here is that you create a piece of code which tests that each function in your code does what you expect it to do.

    Acceptance testing is testing at a higher level, for example for the signup process.

    The great thing to do with testing is to have an automated test suite which runs all the tests and reports whether they succeeded or not. What automated testing is great for is when a change somewhere in the system could affect another part of the system which you wouldn’t have thought of. It is also great for refactoring as you can refactor code quickly and the tests are in place to tell you whether you have introduced any bugs.

    Testing is a tricky thing to get into the habit of, and I’m still partly along that process, but I know the value of it.
  • Right, another of the specific techniques is cloud computing.

    I see this being really great right now and even more so in the future.

    What we have are cloud storage services like Amazon S3. All of the profile pictures on OnePage are on S3 and there are quite a lot and it literally costs pennies. It’s all hosted reliably by Amazon and it even uses their content delivery network which means the images are served from one of 11 locations around the world whichever is closest to the user so it is great for performance too. It simply doesn’t make sense to host your images, CSS or JavaScript anywhere else in my opinion.

    Then we’ve got Cloud computing. The best examples of this are Amazon EC2 and Rackspace CloudServers. These allow us to on-demand fire up full servers (virtual machines). This means scaling our applications in the future is going to be very simple, as there are APIs and we can automatically scale up between different sized servers on EC2 or CloudServers. Prices are coming down for these services and it will soon make very little sense to deal with all the headaches of regular sysadmin.

    There are a host of other cloud services which are very useful. I use cloud services for email and for acceptance testing.
  • We’ve talked about basing our decisions on facts rather than opinion and split testing is a core way to do that.

    Split testing is the act of testing a change to a feature or part of an app against what is in place right now.

    Since when we change something we must expect that it will improve a certain metric (otherwise we wouldn’t do it!), it makes sense to test this assumption.

    The best example is when you think of a new landing page design. With split testing, you can test the new landing page alongside the old one and check that it improves the conversion rate for the acquisition metric.

    Split testing is great, but I’ve found that when you are just starting out the amount of data can affect things. I will however be detailing something which is similar to split testing that I’ve done within CodeIgniter.
  • Continuous deployment is the final technique I’ll talk about before we get stuck into some CodeIgniter stuff. It is a crazy idea and it’s probably been the most controversial of the techniques.

    The idea is that after you’ve committed code to the repository, within 20 minutes it will actually be live and users will be using it.

    I’m sure you’re thinking of all the things that could go wrong.

    Sound crazy? Well continuous deployment is a way to do that safely and it involves the testing I mentioned earlier. I’ll go into more of this later on.
  • Right, so I guess that was your rapid crash course in startups. If we call that theory I’m about to get onto implementation.

    Before I go on, does anyone have any questions?

    Right, so what on earth does all this have to do with CodeIgniter?

    Well, going back to Eric Ries’ definition of the lean startup, the first point was the use of open source platforms. I actually believe that CodeIgniter is a fantastic platform for lean startups.

    The reasons are that it is very lightweight and it therefore follows the principles of “Don’t Repeat Yourself” but at the same time it doesn’t do so much that you have to start ripping parts away from it.

    Also, we can take advantage of a huge number of the techniques without doing any work ourselves because of all the libraries out there.

    And this of course is all enabled by the fantastic community around CodeIgniter.
  • In this second half of my talk, I’m going to firstly go through a few quick examples of simply using libraries out there people have made to build some of the fundamental aspects of a startup. Then I’ll go into some detailed examples with code for implementing three key lean startup techniques in CodeIgniter. I’ll finish with three other techniques we can use to increase our speed around the feedback loop.
  • Right, so there are literally hundreds of libraries out there we can use to give ourselves a head start with our startup if we choose CodeIgniter as the platform.

    Firstly, we have Elliot Haughin’s social libraries. I won’t go into too much detail of this since (he’s already gone into detail of it / I think he’ll be talking about it).

    Then I’ll talk about integrating a PHP library called CloudFusion into CodeIgniter to help us use Amazon Web Services and store all our images on Amazon S3.

    The last library I’ll show you is a very simple vCard library which I’m using right now for a feature coming to OnePage pretty soon.
  • OnePage makes use of Elliot’s Twitter library and it makes things so staightforward.

    All we need to do is load the library in our controller with this->load->library(‘twitter’) and then do the OAuth authentication handshake (for which there is an example), and then we have access to the whole Twitter API through the call method.

    For OnePage it is used for allowing users to follow the OnePage Twitter, update their status and update their website as well as for grabbing all their data from Twitter in the signup process to create their whole card auto-magically :)
  • The second easy to implement library is called CloudFusion and it can be integrated as a library in CodeIgniter simply by grabbing the files and putting them in their own folder in the libraries directory and then creating a wrapper which will give you access to the library.
  • Once that is done, we can do things like upload images, css and javascript to S3 and we could also do other things like even fire up EC2 instances.

    This example grabs an image someone has uploaded and put’s it in an Amazon S3 bucket as a jpeg file. Being able to do all of that in just a few lines of code is really quite amazing.
  • The third library I’m going to show you is one which I’m using for an upcoming feature in OnePage.

    It’s a vCard library made by a guy called Carlos Alcala and it makes it very straightforward to create vcard format files from data.
  • As we can see, all we need to do is place the library in our application/libraries directory and then we can just load it and pass it an array of user information, and then it’s simply one method to serve the vcard to the visitor. It really couldn’t be simpler!
  • OK, cool, so we’ve seen how we can use the libraries out there to get moving fast. The great thing is there is so much out there that you can take and piece together to build your app that it leaves only a small amount to build yourself! I feel like a bit of a fraud but really OnePage is built on a lot of other people’s code. It’s the best way :)

    However, there are a number of things I wanted to get working which are techniques of the lean startup and these weren’t available as libraries I was aware of at the time. So I’m going to run through 3 key lean startup techniques implemented in CodeIgniter. These are unit & acceptance testing and continuous deployment which I described earlier, and feature flipping which is something closely related to split testing.
  • So, as I described earlier, the concept of automated testing is that you test that what you are coding is doing what you intend it to do.

    There are a number of testing frameworks for PHP, one being PHPUnit which is popular but has not seen an update for quite some time. The more intuitive one I have found is SimpleTest which is a great framework.

    Jamie Rumbelow, who is a very active member of the CodeIgniter community did some great work a while ago to integrate SimpleTest into CodeIgniter.

    Along with SimpleTest for mainly unit testing and some acceptance testing where JavaScript is not required, Selenium is a great bit of software which lets you automate actual browser activity in a number of browsers.

    The creators of Selenium have developed SauceLabs which is a great cloud-based Selenium service and it means that if you start to have quite a number of acceptance tests or if you want to test many browsers then it can all be done in parallel instead of a single test at a time as would be the case on a single machine. This means we can keep that speed around the feedback loop as high as possible and can learn as quickly as possible.

  • What you end up with is a “Test Suite” which will allow you to run all of the tests.

    If all the tests are passing, then you have a nice green bar, but if any tests fail then you’ll be notified and told what exactly has failed.

    The great thing about this is that as you build up a lot of tests, you can automatically test that everything you have previously developed is still working as it should even when you introduce new functionality.

    What we are seeing here is the HTML output of the tests, which is nice but what is very handy is that it is very easy to grab an XML output of this too. Of course once we have XML output, it becomes machine-readable and that enables us to do even more. That leads us nicely onto...
  • What you end up with is a “Test Suite” which will allow you to run all of the tests.

    If all the tests are passing, then you have a nice green bar, but if any tests fail then you’ll be notified and told what exactly has failed.

    The great thing about this is that as you build up a lot of tests, you can automatically test that everything you have previously developed is still working as it should even when you introduce new functionality.

    What we are seeing here is the HTML output of the tests, which is nice but what is very handy is that it is very easy to grab an XML output of this too. Of course once we have XML output, it becomes machine-readable and that enables us to do even more. That leads us nicely onto...
  • Continuous deployment!

    As I mentioned in the first half of the talk, continuous deployment is a process whereby we can deploy code live to the production server within 20 minutes of committing it to our repository.

    In order to do this safely, we bring in the automated testing into the deployment process.

    So what happens is that each time we commit to the repository, all the tests are automatically run. If they all pass, then we deploy to production.

    Each developer has their own full local sandbox with the test suite so they can test everything before they commit.

    The way this is implemented is using Hudson, which is a continuous integration server which is straight-forward to install on a server. What Hudson can do is hook into various things and then perform various actions. In our case we’re hooking into the SVN Repository to detect when there is new code, and then we automatically run all our tests. This works by taking the code from the repository, doing a full build of the application and then running the tests, which get output in XML format.

    Unfortunately Hudson is setup by default to accept PHPUnit style XML and does not support the SimpleTest format.

    I therefore grabbed some XSL transformation code to convert it into the correct format.

    The final step of the process is to detect if the tests passed and then deploy if they did. For this, a shell script is run which then runs a bit of PHP which simply parses the XML and then uses the beanstalk API to deploy the app live to the server. I’ll explain beanstalk a little later if you’re not sure what I’m talking about.
  • Some of you might be thinking that there are still things could go wrong, and you would be correct. There is only so much you can test in an automated fashion.

    Eric Ries has a great example to describe how this could happen. He talks about a developer feeling like having a bit of fun one day and deciding to change the payment button to the same colour as the background of the website. So we just went from having a business to having a hobby!

    In the future, I want to build into my continuous deployment setup what Eric Ries calls a cluster immune system. The cluster immune system monitors some key metrics such as revenue in a certain time-frame. If any metrics go outside a threshold which we expect them to be within, this too could trigger that the build is a failure. The cluster immune system then rolls back to the last working version and the development team is notified by email and must stop everything until they’ve worked out what was wrong.
  • Feature flipping is another technique I’ve been putting into practice with OnePage which relates closely to the lean startup techniques.

    Feature flipping allows you to give certain users access to features whilst restricting access for others.

    When you’re doing continuous deployment, this is very useful because it means you can develop and test functionality and have it live but you can also separate the marketing launch of a feature from the development launch. This is a big advantage because a lot of problems can happen when you’re rushing to get a feature ready for deployment leading up to a big marketing splash and it’s a good idea to separate these two events.

    The implementation for OnePage is very straight-forward right now, it is simply a case of storing a string of serialized features as comma separated values for each user and then translating those into an array.

    Dan Horrigan has developed a library called turnstiles which incorporates this functionality and it’s definitely worth a look :)

  • And here’s my OnePage. This is what you can get for yourself if you go along to, it only takes a minute and you can sign up with Twitter, LinkedIn or Facebook.

    Mobile apps are on the way.
  • ×