Running an Open-Source CodeIgniter project

44
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 protected] http://philsturgeon.co.uk http://twitter.com/philsturgeon http://github.com/philsturgeon

Transcript of Running an Open-Source CodeIgniter project

Page 1: Running an Open-Source CodeIgniter project

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

Phil [email protected]

http://philsturgeon.co.uk

http://twitter.com/philsturgeon

http://github.com/philsturgeon

Page 2: Running an Open-Source CodeIgniter project

IntroductionMy history in open-source

Page 3: Running an Open-Source CodeIgniter project

IntroductionMy history in open-source

Page 4: Running an Open-Source CodeIgniter project

IntroductionMy history in open-source

Page 5: Running an Open-Source CodeIgniter project

Work for Mizu Design Ltd

IntroductionWhat do I do these days?

Page 6: Running an Open-Source CodeIgniter project

Work for Mizu Design Ltd

Creating internal CodeIgniter applications

IntroductionWhat do I do these days?

Page 7: Running an Open-Source CodeIgniter project

Work for Mizu Design Ltd

Creating internal CodeIgniter applications

MojoMotor Plugins

IntroductionWhat do I do these days?

Page 8: Running an Open-Source CodeIgniter project

Work for Mizu Design Ltd

Creating internal CodeIgniter applications

MojoMotor plugins

ExpressionEngine modules

IntroductionWhat do I do these days?

Page 9: Running an Open-Source CodeIgniter project

Work for Mizu Design Ltd

Creating internal CodeIgniter applications

MojoMotor plugins

ExpressionEngine modules

PyroCMS development

IntroductionWhat do I do these days?

Page 10: Running an Open-Source CodeIgniter project

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 PyroCMSStyleDNA produces StyleCMS

Page 11: Running an Open-Source CodeIgniter project

Brief history of PyroCMSTurns out, looks matter!

Page 12: Running an Open-Source CodeIgniter project

Brief history of PyroCMSTurns out, looks matter!

Page 13: Running an Open-Source CodeIgniter project

Basic Principles

Page 14: Running an Open-Source CodeIgniter project

Basic Principles

Clients are stupid

Page 15: Running an Open-Source CodeIgniter project

“Can you put a redirect on Amazon to our homepage?”

Basic PrinciplesClients are stupid

Page 16: Running an Open-Source CodeIgniter project

Basic PrinciplesClients are stupid

"Why does 'N' come after 'L' in this alphabetical listing?!"

Page 17: Running an Open-Source CodeIgniter project

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

Basic PrinciplesClients are stupid

Page 18: Running an Open-Source CodeIgniter project

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 PrinciplesClients are stupid

Page 19: Running an Open-Source CodeIgniter project

Clients are stupid

Developers are lazy

Basic Principles

Page 20: Running an Open-Source CodeIgniter project

Documentation

Easy upgrades

Use a logical folder structureaddons

libraries

modules

themes

system

codeigniter

pyrocms

uploads

Basic PrinciplesDevelopers are lazy

Page 21: Running an Open-Source CodeIgniter project

system

codeigniter

pyrocms

controllers

libraries

models

modules

views

Basic PrinciplesFolder Structure

Page 22: Running an Open-Source CodeIgniter project

addons

helpers

libraries

modules

themes

widgets

Basic PrinciplesDevelopers are lazy

Page 23: Running an Open-Source CodeIgniter project

addons

helpers

libraries

modules

themes

widgets

Basic PrinciplesDevelopers are lazy

Packages available in CodeIgniter 2.0

Page 24: Running an Open-Source CodeIgniter project

addons

helpers

libraries

modules

themes

widgets

Basic PrinciplesDevelopers are lazy

Packages available in CodeIgniter 2.0

Modular Separation (BitBucket)

Page 25: Running an Open-Source CodeIgniter project

addons

helpers

libraries

modules

themes

widgets

Basic PrinciplesDevelopers are lazy

Packages available in CodeIgniter 2.0

Modular Separation (BitBucket)

Template library (BitBucket)

Page 26: Running an Open-Source CodeIgniter project

addons

helpers

libraries

modules

themes

widgets

Basic PrinciplesDevelopers are lazy

Packages available in CodeIgniter 2.0

Modular Separation (BitBucket)

Template library (BitBucket)

Crazy code, not available

Page 27: Running an Open-Source CodeIgniter project

Clients are stupid

Developers are lazy

Designers are control freaks

Basic Principles

Page 28: Running an Open-Source CodeIgniter project

Themes

Don’t mess with their HTML

Let them mess with your HTML

Don’t give them enough rope!

Basic PrinciplesDesigners are control freaks

Page 29: Running an Open-Source CodeIgniter project

Clients are stupid

Developers are lazy

Designers are control freaks

EllisLab are always “right”

Basic Principles

Page 30: Running an Open-Source CodeIgniter project

Never modify the core of CodeIgniter

Basic PrinciplesEllisLab are always “right”

Page 31: Running an Open-Source CodeIgniter project

Basic PrinciplesEllisLab are always “right”

Never modify the core of CodeIgniter

Not enough PHP 5?

Page 32: Running an Open-Source CodeIgniter project

Basic PrinciplesEllisLab 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’);

Page 33: Running an Open-Source CodeIgniter project

Never modify the core of CodeIgniter

Not enough PHP 5?

Extend for the win

Basic PrinciplesEllisLab are always “right”

Page 34: Running an Open-Source CodeIgniter project

Basic PrinciplesEllisLab are always “right”

MY_Exceptions - Custom 404 messages

Page 35: Running an Open-Source CodeIgniter project

Basic PrinciplesEllisLab are always “right”

MY_Form_validation - Extra Validation

Page 36: Running an Open-Source CodeIgniter project

Basic PrinciplesEllisLab are always “right”

MY_Security - Allow some naughty tags through

Page 37: Running an Open-Source CodeIgniter project

Basic PrinciplesEllisLab 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

Page 38: Running an Open-Source CodeIgniter project

Clients are stupid

Developers are lazy

Designers are control freaks

EllisLab are always “right”

Basic Principles

Page 39: Running an Open-Source CodeIgniter project

Managing the Code

Page 40: Running an Open-Source CodeIgniter project

Managing the Code

Page 41: Running an Open-Source CodeIgniter project

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 CodeMaster, Branches, Tags

Master

Page 42: Running an Open-Source CodeIgniter project

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 CodeMaster, Branches, Tags

Branches

Page 43: Running an Open-Source CodeIgniter project

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 CodeMaster, Branches, Tags

Tags

Page 44: Running an Open-Source CodeIgniter project

User owned copy of your repository

People do your work for you

Use it to trial new contributors

Managing the CodeMaster, Branches, Tags

Forks