Running an Open-Source CodeIgniter project

Post on 29-Jan-2018

2.124 views 0 download

Transcript of 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 Sturgeonemail@philsturgeon.co.uk

http://philsturgeon.co.uk

http://twitter.com/philsturgeon

http://github.com/philsturgeon

IntroductionMy history in open-source

IntroductionMy history in open-source

IntroductionMy history in open-source

Work for Mizu Design Ltd

IntroductionWhat do I do these days?

Work for Mizu Design Ltd

Creating internal CodeIgniter applications

IntroductionWhat do I do these days?

Work for Mizu Design Ltd

Creating internal CodeIgniter applications

MojoMotor Plugins

IntroductionWhat do I do these days?

Work for Mizu Design Ltd

Creating internal CodeIgniter applications

MojoMotor plugins

ExpressionEngine modules

IntroductionWhat do I do these days?

Work for Mizu Design Ltd

Creating internal CodeIgniter applications

MojoMotor plugins

ExpressionEngine modules

PyroCMS development

IntroductionWhat do I do these days?

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

Brief history of PyroCMSTurns out, looks matter!

Brief history of PyroCMSTurns out, looks matter!

Basic Principles

Basic Principles

Clients are stupid

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

Basic PrinciplesClients are stupid

Basic PrinciplesClients are stupid

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

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

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

Clients are stupid

Developers are lazy

Basic Principles

Documentation

Easy upgrades

Use a logical folder structureaddons

libraries

modules

themes

system

codeigniter

pyrocms

uploads

Basic PrinciplesDevelopers are lazy

system

codeigniter

pyrocms

controllers

libraries

models

modules

views

Basic PrinciplesFolder Structure

addons

helpers

libraries

modules

themes

widgets

Basic PrinciplesDevelopers are lazy

addons

helpers

libraries

modules

themes

widgets

Basic PrinciplesDevelopers are lazy

Packages available in CodeIgniter 2.0

addons

helpers

libraries

modules

themes

widgets

Basic PrinciplesDevelopers are lazy

Packages available in CodeIgniter 2.0

Modular Separation (BitBucket)

addons

helpers

libraries

modules

themes

widgets

Basic PrinciplesDevelopers are lazy

Packages available in CodeIgniter 2.0

Modular Separation (BitBucket)

Template library (BitBucket)

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

Clients are stupid

Developers are lazy

Designers are control freaks

Basic Principles

Themes

Don’t mess with their HTML

Let them mess with your HTML

Don’t give them enough rope!

Basic PrinciplesDesigners are control freaks

Clients are stupid

Developers are lazy

Designers are control freaks

EllisLab are always “right”

Basic Principles

Never modify the core of CodeIgniter

Basic PrinciplesEllisLab are always “right”

Basic PrinciplesEllisLab are always “right”

Never modify the core of CodeIgniter

Not enough PHP 5?

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

Never modify the core of CodeIgniter

Not enough PHP 5?

Extend for the win

Basic PrinciplesEllisLab are always “right”

Basic PrinciplesEllisLab are always “right”

MY_Exceptions - Custom 404 messages

Basic PrinciplesEllisLab are always “right”

MY_Form_validation - Extra Validation

Basic PrinciplesEllisLab are always “right”

MY_Security - Allow some naughty tags through

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

Clients are stupid

Developers are lazy

Designers are control freaks

EllisLab are always “right”

Basic Principles

Managing the Code

Managing the Code

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

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

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

User owned copy of your repository

People do your work for you

Use it to trial new contributors

Managing the CodeMaster, Branches, Tags

Forks