MainframePHP
The fast PHP framework
Vangelis Bibakis
@ JoomlaDay Greece 2013
About your speaker
Founder: DemianLabs.com
CTO: AdAxem.eu
Creator of: MainframePHP
& many micro web apps
@bibakis
bibakisv@gmail.com
Hey, thanks professor !
What we‟ll talk about today
1. Case studies
2. Productivity
3. Performance
4. Learnability
5. Themes
6. Assets
7. Plugins
8. Libraries
Yet… What is Mainframe ?
• A PHP framework based on CodeIgniter
• Adds essential functionality that
CodeIgniter is missing
• Focused on web apps
• Best open source tools included
( jQuery, Bootstrap, html5 boilerplate & others)
Yet… What is Mainframe ?
In a few words…
“Mainframe is to CodeIgniter,
what Ubuntu is to Debian”
Vangelis
1. Case studies
ARTIFAX EVENT 4
• 600.000 lines of code(so far)
• The “photoshop” of event management
• Large established client base
• Huge feature set
1. Case studies
If Event 4 was a Greek startup
it would be bigger than…
1. Case studies
If Event 4 was a Greek startup
it would be bigger than…
• CSS Igniter
1. Case studies
If Event 4 was a Greek startup
it would be bigger than…
• CSS Igniter
• Incrediblue
1. Case studies
If Event 4 was a Greek startup
it would be bigger than…
• CSS Igniter
• Incrediblue
• Workable
1. Case studies
If Event 4 was a Greek startup
it would be bigger than…
• CSS Igniter
• Incrediblue
• Workable
Combined…
1. Case studies
• DeskHot.com
Bookmark manager, SaaS
• MobileTest.me
Micro web app, responsive design testing
• ConvertPSD2HTML.com
Slicing service, defunct (RIP)
• RandomTextGenerator.com
Micro web app, #1 in it‟s class
2. Productivity
• Before we took over development of Event
4,
3 other companies failed to deliver
2. Productivity
• Before we took over development of Event
4,
3 other companies failed to deliver
• Large feature sets delivered weekly
2. Productivity
• Before we took over development of Event
4,
3 other companies failed to deliver
• Large feature sets delivered weekly
• Constant improvement of UI, workflows
2. Productivity
How Mainframe makes you productive ?
2. Productivity
How Mainframe makes you productive ?
• Expands upon the MVC lifestyle
(everything in it‟s right place)
2. Productivity
How Mainframe makes you productive ?
• Expands upon the MVC lifestyle
(everything in it‟s right place)
• Keeps CodeIgniter‟s coding style
2. Productivity
How Mainframe makes you productive ?
• Expands upon the MVC lifestyle
(everything in it‟s right place)
• Keeps CodeIgniter‟s coding style
• It won‟t say no if you want to get nasty
2. Productivity
How Mainframe makes you productive ?
• Expands upon the MVC lifestyle
(everything in it‟s right place)
• Keeps CodeIgniter‟s coding style
• It won‟t say no if you want to get nasty
• Absolutely no command line needed
(web and nothing but the web)
3. Performance
• 45.000 monthly unique visitors on our
main server
3. Performance
• 45.000 monthly unique visitors on our
main server
• On a small VPS with 384mb of RAM
(that‟s less memory than your phone)
4. Learnability
• Mainframe is built upon the “hackathon
effect”
4. Learnability
• Mainframe is built upon the “hackathon
effect”
• It‟s so similar to CodeIgniter that
inexperienced developers can‟t tell the
difference
5. Themes
Template library by Colin Williams
5. Themes
Template library by Colin Williams
1. Setting the Default Template:
$template['active_group'] = 'default„;
$template['default']['template'] = 'template.php';
5. Themes
Template library by Colin Williams
1. Setting the Default Template:
$template['active_group'] = 'default„;
$template['default']['template'] = 'template.php';
2. Defining Regions
$template['default']['regions'] = array(
'header„,
'content„,
'footer„
);
5. Themes
Template library by Colin Williams
1. Setting the Default Template:
$template['active_group'] = 'default„;
$template['default']['template'] = 'template.php';
2. Defining Regions
$template['default']['regions'] = array(
'header„,
'content„,
'footer„
);
3. Defining Parsers
$template['default']['parser'] = 'smarty_parser„;
Template will call smarty_parser::parse()
$template['default']['parser'] = 'frog_parser„;
$template['default']['parser_method'] = 'frog„;
Template will call frog_parser::frog();
• … And 9 more steps
5. Themes
Where in Mainframe you just do…
$this->load->theme(„Simplicity‟);
…in the controller‟s constructor
6. Assets
3rd party assets libraries for CodeIgniter
Things are a bit better here
There are a few nice libraries
But….
6. Assets
3rd party assets libraries for CodeIgniter
• They are usually abandoned after a while
• They don‟t support minifying/compression
• They don‟t support server side LESS/SASS
• They are not integrated into a theming
system
6. Assets
Mainframe supports
• Integration with the theming system
• Server side LESS
• Server side minification of
JavaScript/CSS/LESS
• Intelligent caching control
• Asset ordering
6. Assets
Sounds a lot but it‟s easy
$this->load->js(„javascript.js‟);
$this->load->css(„stylesheet.css‟);
$this->load->less(„stylesheet.less‟);
In either your theme or your views
6. Assets
Or if you are feeling bohemian
js(„javascript.js‟);
css(„stylesheet.css‟);
less(„stylesheet.less‟);
7. Plugins
Let‟s have a look at the most
popular system for adding support for
Modules / Plugins / HMVC / Whatever you want to call it
“Modular Extensions – HMVC”
by
Wiredesignz
First let‟s look at the documentation…
7. Plugins
In Mainframe
Just place your files in
/app/plugins/plugin_name/
Using the exact same structure as in plain CodeIgniter
/models
/views
/controllers
/helpers
8. Libraries
Libraries in Mainframe have a special place
in /libs
They are grouped by language like so:
• Css
• Js
• Php
• CodeIgniter
• Common
8. Libraries
CodeIgniter is a library ?
• Well… technically no.
• But by treating it as one we have a very
simple upgrade procedure for the times a
new CodeIgniter version is released.
• Delete the old folder, paste the new one.
You don‟t have to touch anything else.
8. Libraries
• Mainframe supports multiple apps all running
from a single installation
• For example you can have
www.deskhot.com
mobile.deskhot.com
intranet.deskhot.com
• “Common” contains all the code you want
shared by all these applications. For example
your custom image resize helper.
Peace & simple living

Mainframe, the fast PHP framework

  • 1.
    MainframePHP The fast PHPframework Vangelis Bibakis @ JoomlaDay Greece 2013
  • 2.
    About your speaker Founder:DemianLabs.com CTO: AdAxem.eu Creator of: MainframePHP & many micro web apps @bibakis bibakisv@gmail.com
  • 3.
  • 4.
    What we‟ll talkabout today 1. Case studies 2. Productivity 3. Performance 4. Learnability 5. Themes 6. Assets 7. Plugins 8. Libraries
  • 5.
    Yet… What isMainframe ? • A PHP framework based on CodeIgniter • Adds essential functionality that CodeIgniter is missing • Focused on web apps • Best open source tools included ( jQuery, Bootstrap, html5 boilerplate & others)
  • 6.
    Yet… What isMainframe ? In a few words… “Mainframe is to CodeIgniter, what Ubuntu is to Debian” Vangelis
  • 7.
    1. Case studies ARTIFAXEVENT 4 • 600.000 lines of code(so far) • The “photoshop” of event management • Large established client base • Huge feature set
  • 9.
    1. Case studies IfEvent 4 was a Greek startup it would be bigger than…
  • 10.
    1. Case studies IfEvent 4 was a Greek startup it would be bigger than… • CSS Igniter
  • 11.
    1. Case studies IfEvent 4 was a Greek startup it would be bigger than… • CSS Igniter • Incrediblue
  • 12.
    1. Case studies IfEvent 4 was a Greek startup it would be bigger than… • CSS Igniter • Incrediblue • Workable
  • 13.
    1. Case studies IfEvent 4 was a Greek startup it would be bigger than… • CSS Igniter • Incrediblue • Workable Combined…
  • 14.
    1. Case studies •DeskHot.com Bookmark manager, SaaS • MobileTest.me Micro web app, responsive design testing • ConvertPSD2HTML.com Slicing service, defunct (RIP) • RandomTextGenerator.com Micro web app, #1 in it‟s class
  • 15.
    2. Productivity • Beforewe took over development of Event 4, 3 other companies failed to deliver
  • 16.
    2. Productivity • Beforewe took over development of Event 4, 3 other companies failed to deliver • Large feature sets delivered weekly
  • 17.
    2. Productivity • Beforewe took over development of Event 4, 3 other companies failed to deliver • Large feature sets delivered weekly • Constant improvement of UI, workflows
  • 18.
    2. Productivity How Mainframemakes you productive ?
  • 19.
    2. Productivity How Mainframemakes you productive ? • Expands upon the MVC lifestyle (everything in it‟s right place)
  • 20.
    2. Productivity How Mainframemakes you productive ? • Expands upon the MVC lifestyle (everything in it‟s right place) • Keeps CodeIgniter‟s coding style
  • 21.
    2. Productivity How Mainframemakes you productive ? • Expands upon the MVC lifestyle (everything in it‟s right place) • Keeps CodeIgniter‟s coding style • It won‟t say no if you want to get nasty
  • 22.
    2. Productivity How Mainframemakes you productive ? • Expands upon the MVC lifestyle (everything in it‟s right place) • Keeps CodeIgniter‟s coding style • It won‟t say no if you want to get nasty • Absolutely no command line needed (web and nothing but the web)
  • 23.
    3. Performance • 45.000monthly unique visitors on our main server
  • 24.
    3. Performance • 45.000monthly unique visitors on our main server • On a small VPS with 384mb of RAM (that‟s less memory than your phone)
  • 25.
    4. Learnability • Mainframeis built upon the “hackathon effect”
  • 26.
    4. Learnability • Mainframeis built upon the “hackathon effect” • It‟s so similar to CodeIgniter that inexperienced developers can‟t tell the difference
  • 27.
    5. Themes Template libraryby Colin Williams
  • 28.
    5. Themes Template libraryby Colin Williams 1. Setting the Default Template: $template['active_group'] = 'default„; $template['default']['template'] = 'template.php';
  • 29.
    5. Themes Template libraryby Colin Williams 1. Setting the Default Template: $template['active_group'] = 'default„; $template['default']['template'] = 'template.php'; 2. Defining Regions $template['default']['regions'] = array( 'header„, 'content„, 'footer„ );
  • 30.
    5. Themes Template libraryby Colin Williams 1. Setting the Default Template: $template['active_group'] = 'default„; $template['default']['template'] = 'template.php'; 2. Defining Regions $template['default']['regions'] = array( 'header„, 'content„, 'footer„ ); 3. Defining Parsers $template['default']['parser'] = 'smarty_parser„; Template will call smarty_parser::parse() $template['default']['parser'] = 'frog_parser„; $template['default']['parser_method'] = 'frog„; Template will call frog_parser::frog(); • … And 9 more steps
  • 32.
    5. Themes Where inMainframe you just do… $this->load->theme(„Simplicity‟); …in the controller‟s constructor
  • 33.
    6. Assets 3rd partyassets libraries for CodeIgniter Things are a bit better here There are a few nice libraries But….
  • 34.
    6. Assets 3rd partyassets libraries for CodeIgniter • They are usually abandoned after a while • They don‟t support minifying/compression • They don‟t support server side LESS/SASS • They are not integrated into a theming system
  • 35.
    6. Assets Mainframe supports •Integration with the theming system • Server side LESS • Server side minification of JavaScript/CSS/LESS • Intelligent caching control • Asset ordering
  • 36.
    6. Assets Sounds alot but it‟s easy $this->load->js(„javascript.js‟); $this->load->css(„stylesheet.css‟); $this->load->less(„stylesheet.less‟); In either your theme or your views
  • 37.
    6. Assets Or ifyou are feeling bohemian js(„javascript.js‟); css(„stylesheet.css‟); less(„stylesheet.less‟);
  • 38.
    7. Plugins Let‟s havea look at the most popular system for adding support for Modules / Plugins / HMVC / Whatever you want to call it “Modular Extensions – HMVC” by Wiredesignz First let‟s look at the documentation…
  • 43.
    7. Plugins In Mainframe Justplace your files in /app/plugins/plugin_name/ Using the exact same structure as in plain CodeIgniter /models /views /controllers /helpers
  • 44.
    8. Libraries Libraries inMainframe have a special place in /libs They are grouped by language like so: • Css • Js • Php • CodeIgniter • Common
  • 45.
    8. Libraries CodeIgniter isa library ? • Well… technically no. • But by treating it as one we have a very simple upgrade procedure for the times a new CodeIgniter version is released. • Delete the old folder, paste the new one. You don‟t have to touch anything else.
  • 46.
    8. Libraries • Mainframesupports multiple apps all running from a single installation • For example you can have www.deskhot.com mobile.deskhot.com intranet.deskhot.com • “Common” contains all the code you want shared by all these applications. For example your custom image resize helper.
  • 47.