Running an Open-Source CodeIgniter project
The tale of PyroCMS - an open-source Content Management
System built with CodeIgniter. What, why and how!


                                  Phil Sturgeon
      email@philsturgeon.co.uk                http://twitter.com/philsturgeon
      http://philsturgeon.co.uk               http://github.com/philsturgeon
Introduction
My history in open-source
Introduction
My history in open-source
Introduction
My history in open-source
Introduction
What do I do these days?
 Work for Mizu Design Ltd
Introduction
What do I do these days?
 Work for Mizu Design Ltd
   Creating internal CodeIgniter applications
Introduction
What do I do these days?
 Work for Mizu Design Ltd
   Creating internal CodeIgniter applications

 MojoMotor Plugins
Introduction
What do I do these days?
 Work for Mizu Design Ltd
   Creating internal CodeIgniter applications

 MojoMotor plugins
 ExpressionEngine modules
Introduction
What do I do these days?
 Work for Mizu Design Ltd
   Creating internal CodeIgniter applications

 MojoMotor plugins
 ExpressionEngine modules
 PyroCMS development
Brief history of PyroCMS
StyleDNA produces StyleCMS

 We realise we need a CMS
 Back in 2007 PyroCMS was first born as
 StyleCMS, a basic CMS for small sites
 StyleDNA fails and burns horribly
 PyroCMS rises from the ashes
Brief history of PyroCMS
Turns out, looks matter!
Brief history of PyroCMS
Turns out, looks matter!
Basic Principles
Basic Principles

Clients are stupid
Basic Principles
Clients are stupid




“Can you put a redirect on Amazon to our
              homepage?”
Basic Principles
Clients are stupid




   "Why does 'N' come after 'L' in this
         alphabetical listing?!"
Basic Principles
 Clients are stupid




  "We refuse to use this font 'Century
GOTHIC Bold'. This is a family-friendly site!"
Basic Principles
Clients are stupid

 Hide confusing things
 Make it hard for them to break the site
 Control, sanitise and correct their input
   WYSIWYG

   MS Word!!!!

   XSS Clean

   CSRF protection
Basic Principles

Clients are stupid
Developers are lazy
Basic Principles
Developers are lazy
 Documentation
 Easy upgrades
 Use a logical folder structure
   addons
      libraries
      modules
      themes
   system
      codeigniter
      pyrocms
   uploads
Basic Principles
Folder Structure

  system
    codeigniter
    pyrocms
       controllers
       libraries
       models
       modules
       views
Basic Principles
Developers are lazy


   addons
     helpers
     libraries
     modules
     themes
     widgets
Basic Principles
Developers are lazy

                      Packages available in CodeIgniter 2.0
   addons
     helpers
     libraries
     modules
     themes
     widgets
Basic Principles
Developers are lazy

                      Packages available in CodeIgniter 2.0
   addons
     helpers           Modular Separation (BitBucket)
     libraries
     modules
     themes
     widgets
Basic Principles
Developers are lazy

                      Packages available in CodeIgniter 2.0
   addons
     helpers           Modular Separation (BitBucket)
     libraries
     modules
                       Template library (BitBucket)
     themes
     widgets
Basic Principles
Developers are lazy

                      Packages available in CodeIgniter 2.0
   addons
     helpers           Modular Separation (BitBucket)
     libraries
     modules
                       Template library (BitBucket)
     themes
     widgets
                       Crazy code, not available
Basic Principles

Clients are stupid
Developers are lazy
Designers are control freaks
Basic Principles
Designers are control freaks


 Themes
 Don’t mess with their HTML
 Let them mess with your HTML
 Don’t give them enough rope!
Basic Principles

Clients are stupid
Developers are lazy
Designers are control freaks
EllisLab are always “right”
Basic Principles
EllisLab are always “right”


 Never modify the core of CodeIgniter
Basic Principles
EllisLab are always “right”


 Never modify the core of CodeIgniter
 Not enough PHP 5?
Basic Principles
   EllisLab are always “right”

    Library autoload

   Call more than singletons:

   $foo = new Something(‘bar’);
   $bar = new Something(‘baz’);


Use some kick-ass PHP 5 syntax:

    $foo = Settings::item(‘bar’);
Basic Principles
EllisLab are always “right”


 Never modify the core of CodeIgniter
 Not enough PHP 5?
 Extend for the win
Basic Principles
EllisLab are always “right”

         MY_Exceptions - Custom 404 messages
Basic Principles
EllisLab are always “right”
          MY_Form_validation - Extra Validation
Basic Principles
EllisLab are always “right”
      MY_Security - Allow some naughty tags through
Basic Principles
EllisLab are always “right”
            MY_Parser - Dwoo it!

 Template parser in CI blows for... pretty much everything.

                       {$message}

            {anchor(‘controller’, ‘Some page’)}

                        {lang($foo)}

               {if $user->group == ‘admin’)}

                      http://dwoo.org/
    http://bitbucket.org/philsturgeon/codeigniter-dwoo
Basic Principles

Clients are stupid
Developers are lazy
Designers are control freaks
EllisLab are always “right”
Managing the Code
Managing the Code
Managing the Code
Master, Branches, Tags
Master

 Same as Subversion trunk
 Default “branch” of the repository
 $ git clone git://github.com/pyrocms/pyrocms.git
 Should always be ready to tag or download, keep it stable!
Managing the Code
Master, Branches, Tags
Branches

 Keep code out of the way
 v1.0-dev is relatively stable
 v2.0-dev seriously fucked
 Work on X feature independent of version Y
 $ git checkout v1.0-dev
Managing the Code
Master, Branches, Tags
Tags

 Tag each version
 Marks a specific commit as a version
 Automatic “Downloads” entry on GitHub
 http://github.com/pyrocms/pyrocms/zipball/v0.9.9.7
 http://github.com/pyrocms/pyrocms/zipball/{$variable.cms_version}
Managing the Code
Master, Branches, Tags
Forks

 User owned copy of your repository
 People do your work for you
 Use it to trial new contributors

Running an Open-Source CodeIgniter project