Implementing a Symfony-based CMS System
               Marcos Labad
about me & this talk
●   Since 1998 in the Internet Industry (Kelkoo,
    Yahoo!, BuyVIP)
●   Technology and Internet passionate
●   Founder of Acilia Internet, Spanish development
    company based on Madrid


    This talk is about real experiences and
    recommendations
contents

●   Project plan: Before hands on starts
●   Why Symfony and Doctrine
●   Choosing the right partners for usability and
    design
●   Techniques and CMS features to evaluate
●   Maintenance and final delivery
project plan
●   Imagine the moment of delivery and plan
    backwards – examine every piece
●   Designate stakeholders
●   Open communication channels, recurrent
    follow-up
●   Tests beginning the first day
                                    Tools like Symfony helps you to
                                    predict project timings and efforts
                                    dramatically. The more projects you
                                    develop, the more accurate you'll
                                    be.
project plan

●   Project management is people management
    and organization

●   Trained and experienced people performs >
    x10 more
project success
         5%




                        People (55%)
                        Communication
                        (40%)
                 40%
                        Other (5%)
55%                     Luck (0%)
why Symfony

●   Very active development and support
●   Learning curve but really good documentation
●   Big Growing Community
●   One of the most complete PHP Framework
●   Admin generator: Rocks!
●   Form framework: Rocks!
why Symfony
●   For the final project owner: easy maintenance
    and support
●   Product based on good practices and design
    patterns: lower risk
●   For the development company: reusable
    developments / development intelligence.
●   For the development company: easy to
    integrate new engineers to the project
why Doctrine

●   Hard choice, we used Propel in the past

●   Great documentation.

●   Our perception: more activity, community
    support
why PHP

●   Used on most of the high traffic websites
    (Facebook, Yahoo!, Wikipedia)
●   Easy to learn, easy to use (Scripting language)
●   Nifty vs. tedious languages
●   #1 language on the web
●   Years of experience and tools   If you reach the point where PHP
                                    is the performance bottleneck,
●   Performance?                    congratulations: You have a
                                    Grade A application faster than
                                    99% webs over the Internet
why not Joomla or Drupal
●   If the project has some complexity or somewhat
    specific features, you'll problably have to
    dismantle it
●   Not optimal for specific data models
●   Fast to implement and install. Really hard (or
    impossible) to customize and maintain
●   It has also a learning curve   You'll face the question: Yes, but
                                   whitehose.gov is made on
                                   Drupal!!

                                   Whitehouse.gov is a simple
                                   project, with common data models
Usability and Design

●   Jobeet Chapter 2 - “The project” is great and
    seems simple, but it is not that simple.

●   Reaching a simple mock-up requires quite a lot
    effort and needs all stakeholders input.

●   You should plan this stage carefully
Simple search or
advanced search?     Unique RSS Feed
How will the         or RSS feed per
results look like?   category?


How many
categories will be   Who can post a
displayed?           job



What are the         How many results
fields needed?       should we display

                     Is there any ad
Can we sort by?      space? How do
                     we manage it?
Usability and Design
●   You will have to face many confronted interest
    in your client (editors want a good backend,
    product developers a cool front-end with no
    ads, business people a big ad space, CEOs a
    cheap and good quality website...)
●   UX and Design professionals are out there.
    Partner with them! You will save time (and
    health)
Usability and Design

●   A great application can be seen as poor
    because of a wrong graphic design

●   A poor application can be seen as great with a
    good graphic design
CMS Features

●   One of the first questions is what to manage.

●   Every piece can live without the “administration”
    software

●   The more management, the more complexity
CMS Models Classification

●   Content (Articles, Videos, Images, Galleries...)

●   Templates (Probably the most complex part)

●   Users & Community (Frontpage, Backend,
    Permissions)
Data
●   Data Model

●   Do we have data to import?

●   Tasks – Initial load. Incremental load

●   301 redirects from old urls to new urls
    (Important)
Backend
●   Intensive use of admin generator

●   Fast for models management

●   Look for solutions for objects relationships
       –   Pop-ups
       –   Lightbox               Extesions of sfWidgetForm Class
       –   JQuery plugins
Shared Characteristics - Behaviours

●   Doctrine Behaviours will help to build shared
    characteristics for models
       –   Visible
       –   Commentable
       –   Tagable
       –   Navigation Related
       –   Attributable
       –   ...
CMS Models - Navigation

●   Navigation is the central taxonomy column in
    the CMS system

●   Nested set – Multiple roots

●   Content and Template models are related to it
CMS Models - Domains

●   CMS accepting multiple sites

●   Content can be asociated to multiple domains,
    but must have a main domain

●   Decision: Multiple categories ?
CMS Models - Articles

●   Texts with several images (or other objects) associated

●   Cover Image – Representative image


●   Creation time, Publish time

●   Multiple templates system
    ●   Virtual fields vs. Real fields
    ●   Inspired in Radius - Radiant CMS (http://radiantcms.org/) and Liquid -
        macro language, similar to HTML
    ●   YAML
Multi-template Articles

    Template (Backend)             Article (Backend)        Article (Frontend)

                                  * Gets template and       * Renders the
    * Skeleton fo the final       ask for necessary         content, based on
    layout. It contains the       information.              the template and the
    HTML + tag based
    template engine
                              +   * Generates Form
                                                        =   data stored in the
                                                            backend.
    syntax                        Widgets.

                                  * Virtual fields -
                                  YAML




Designers / Front-end engineers        Editors
Article Multi-template system
     Template Example

     <div class="post_content">

           <div class="photo_container">
                <snippet:showImage config: { name: vertical_image } >
                      <?php echo $record->tag (236,356) ?>
                      <ul class="options_pics">

                          <li class="full"><a href="<?php echo $record->url(350,450) ?>" rel="facebox">full
picture</a></li>
                             <li class="author"><p><?php echo $record->caption ?><br />
                           <b> <?php echo $record->copy_right ?></b></p></li>
                       </ul>
                </snippet:showImage>
                <blockquote>
               <span></span><br /><snippet:fieldText config: { name: quote } /></blockquote>
           </div><!-- .photo_container -->
YAML Storage

vertical_image:
 id: '190784'
quote: 'Zara to land in India in 2010'
main_text:
 Text: "
Zara group is opening new stores in India,
starting with a major shop in Delhi, .....”
CMS Models -Images

●   Elements (name, file, width, height...)
●   Resize on demand (GD, Imagemagick)
●   Storage
       –   CDN
       –   Custom server optimized (lighthttpd, cherokee...)
       –   Every server (Rsync sycronization, reverse proxy)
Original Image            Thumbnail with
                           Gravity Top




                   Thumbnail
                 without Gravity
Template Management - Navigation

●   Ability to manage and automate layouts, templates
    and modules: not only a template language.

●   Layouts (decorators) and templates are associated to a
    navigation points

●   Hierarchical Inheritance

●   Backend controls template system
Template Management - Navigation

    Template (Backend)            Template Configuration         Page (Frontend)
                                        (Backend)
                                                                * Renders the
    * Skeleton fo the final       * Gets template and ask       content, based on
    layout. It contains the       for necessary                 the template and the
    HTML + tag based
    template engine
                              +   information.              =   data stored in the
                                                                backend.
    syntax                        * Generates Form
                                  Widgets.

                                  * Virtual fields.




Designers / Front-end engineers             Editors
Template Management
Template Example
 <ul class="home_links">
   <li>
     <ul>
      <snippet:eachArticle config: { name: enlace_articulo_moda }>
      <li><a href="<?php echo $record->url ?>">
 <?php echo $record->getTitle() ?>
 </a></li>
       </snippet:eachArticle>
     </ul>
     <p><a href="/moda"> ver todas las noticias de 'moda'</a></p>
   </li>
   <li>
Template Configuration
Other Features and tools

●   User Management and permissions (sfGuardUser)


●   Comments Moderation


●   Custom data models (sport standings, real state listings...)


●   Sphinx search


●   External Feeds


●   Git
Infraestructure
Web
Users          Internet                            Load Balancer




                                            Web Server 1     Web Server 2




 Multiservice Backend
                                 Write Queries
                                                           Read Queries




                          Master DB                                  Slave DB
Performance
                     $timer = sfTimerManager::getTimer('myTimer');

                     // Do things
●   Symfony timer    ...

                     // Stop the timer and add the elapsed time
                     $timer->addTime();

                     // Get the result (and stop the timer if not already stopped)
                     $elapsedTime = $timer->getElapsedTime();


●   Routing cache in versions 1.2.x
Performance

●   Doctrine Query and Results cache

●   Control Hydrations
                                   Cache Manager


●   Symfony View Cache
                                    Load Testing


●   Memcached
delivery and acceptance
●   Maintenance is another topic, will the final
    customer/users need it.

●   Identify what to maintain from the beginning
    (infraestructure, templating, design...)

●   Many times, you'll find yourself maintaining not
    being able to leave the project! Plan
    acceptance
Some Clients feedback
●   “I expected bugs!! Where are they?” (Or where
    are they in the planification?)
●   “I expected a traffic drop. It is increasing since
    first day!!”
●   “Symfony is slow? My site is fast!!” - Many
    times performance issues are not in the
    framework or language (PHP) itself.
That's the Symfony Way
Thanks!


             reach me @
          my company: http://www.acilia.es
          blog: http://www.quevidaesta.com
             twitter: http://twitter.com/esmiz
                      mail: marcos@acilia.es

Implementing a Symfony Based CMS in a Publishing Company

  • 1.
    Implementing a Symfony-basedCMS System Marcos Labad
  • 2.
    about me &this talk ● Since 1998 in the Internet Industry (Kelkoo, Yahoo!, BuyVIP) ● Technology and Internet passionate ● Founder of Acilia Internet, Spanish development company based on Madrid This talk is about real experiences and recommendations
  • 3.
    contents ● Project plan: Before hands on starts ● Why Symfony and Doctrine ● Choosing the right partners for usability and design ● Techniques and CMS features to evaluate ● Maintenance and final delivery
  • 4.
    project plan ● Imagine the moment of delivery and plan backwards – examine every piece ● Designate stakeholders ● Open communication channels, recurrent follow-up ● Tests beginning the first day Tools like Symfony helps you to predict project timings and efforts dramatically. The more projects you develop, the more accurate you'll be.
  • 5.
    project plan ● Project management is people management and organization ● Trained and experienced people performs > x10 more
  • 6.
    project success 5% People (55%) Communication (40%) 40% Other (5%) 55% Luck (0%)
  • 7.
    why Symfony ● Very active development and support ● Learning curve but really good documentation ● Big Growing Community ● One of the most complete PHP Framework ● Admin generator: Rocks! ● Form framework: Rocks!
  • 8.
    why Symfony ● For the final project owner: easy maintenance and support ● Product based on good practices and design patterns: lower risk ● For the development company: reusable developments / development intelligence. ● For the development company: easy to integrate new engineers to the project
  • 9.
    why Doctrine ● Hard choice, we used Propel in the past ● Great documentation. ● Our perception: more activity, community support
  • 10.
    why PHP ● Used on most of the high traffic websites (Facebook, Yahoo!, Wikipedia) ● Easy to learn, easy to use (Scripting language) ● Nifty vs. tedious languages ● #1 language on the web ● Years of experience and tools If you reach the point where PHP is the performance bottleneck, ● Performance? congratulations: You have a Grade A application faster than 99% webs over the Internet
  • 11.
    why not Joomlaor Drupal ● If the project has some complexity or somewhat specific features, you'll problably have to dismantle it ● Not optimal for specific data models ● Fast to implement and install. Really hard (or impossible) to customize and maintain ● It has also a learning curve You'll face the question: Yes, but whitehose.gov is made on Drupal!! Whitehouse.gov is a simple project, with common data models
  • 13.
    Usability and Design ● Jobeet Chapter 2 - “The project” is great and seems simple, but it is not that simple. ● Reaching a simple mock-up requires quite a lot effort and needs all stakeholders input. ● You should plan this stage carefully
  • 14.
    Simple search or advancedsearch? Unique RSS Feed How will the or RSS feed per results look like? category? How many categories will be Who can post a displayed? job What are the How many results fields needed? should we display Is there any ad Can we sort by? space? How do we manage it?
  • 15.
    Usability and Design ● You will have to face many confronted interest in your client (editors want a good backend, product developers a cool front-end with no ads, business people a big ad space, CEOs a cheap and good quality website...) ● UX and Design professionals are out there. Partner with them! You will save time (and health)
  • 16.
    Usability and Design ● A great application can be seen as poor because of a wrong graphic design ● A poor application can be seen as great with a good graphic design
  • 17.
    CMS Features ● One of the first questions is what to manage. ● Every piece can live without the “administration” software ● The more management, the more complexity
  • 18.
    CMS Models Classification ● Content (Articles, Videos, Images, Galleries...) ● Templates (Probably the most complex part) ● Users & Community (Frontpage, Backend, Permissions)
  • 19.
    Data ● Data Model ● Do we have data to import? ● Tasks – Initial load. Incremental load ● 301 redirects from old urls to new urls (Important)
  • 20.
    Backend ● Intensive use of admin generator ● Fast for models management ● Look for solutions for objects relationships – Pop-ups – Lightbox Extesions of sfWidgetForm Class – JQuery plugins
  • 22.
    Shared Characteristics -Behaviours ● Doctrine Behaviours will help to build shared characteristics for models – Visible – Commentable – Tagable – Navigation Related – Attributable – ...
  • 23.
    CMS Models -Navigation ● Navigation is the central taxonomy column in the CMS system ● Nested set – Multiple roots ● Content and Template models are related to it
  • 26.
    CMS Models -Domains ● CMS accepting multiple sites ● Content can be asociated to multiple domains, but must have a main domain ● Decision: Multiple categories ?
  • 27.
    CMS Models -Articles ● Texts with several images (or other objects) associated ● Cover Image – Representative image ● Creation time, Publish time ● Multiple templates system ● Virtual fields vs. Real fields ● Inspired in Radius - Radiant CMS (http://radiantcms.org/) and Liquid - macro language, similar to HTML ● YAML
  • 29.
    Multi-template Articles Template (Backend) Article (Backend) Article (Frontend) * Gets template and * Renders the * Skeleton fo the final ask for necessary content, based on layout. It contains the information. the template and the HTML + tag based template engine + * Generates Form = data stored in the backend. syntax Widgets. * Virtual fields - YAML Designers / Front-end engineers Editors
  • 30.
    Article Multi-template system Template Example <div class="post_content"> <div class="photo_container"> <snippet:showImage config: { name: vertical_image } > <?php echo $record->tag (236,356) ?> <ul class="options_pics"> <li class="full"><a href="<?php echo $record->url(350,450) ?>" rel="facebox">full picture</a></li> <li class="author"><p><?php echo $record->caption ?><br /> <b> <?php echo $record->copy_right ?></b></p></li> </ul> </snippet:showImage> <blockquote> <span></span><br /><snippet:fieldText config: { name: quote } /></blockquote> </div><!-- .photo_container -->
  • 32.
    YAML Storage vertical_image: id:'190784' quote: 'Zara to land in India in 2010' main_text: Text: " Zara group is opening new stores in India, starting with a major shop in Delhi, .....”
  • 33.
    CMS Models -Images ● Elements (name, file, width, height...) ● Resize on demand (GD, Imagemagick) ● Storage – CDN – Custom server optimized (lighthttpd, cherokee...) – Every server (Rsync sycronization, reverse proxy)
  • 34.
    Original Image Thumbnail with Gravity Top Thumbnail without Gravity
  • 35.
    Template Management -Navigation ● Ability to manage and automate layouts, templates and modules: not only a template language. ● Layouts (decorators) and templates are associated to a navigation points ● Hierarchical Inheritance ● Backend controls template system
  • 37.
    Template Management -Navigation Template (Backend) Template Configuration Page (Frontend) (Backend) * Renders the * Skeleton fo the final * Gets template and ask content, based on layout. It contains the for necessary the template and the HTML + tag based template engine + information. = data stored in the backend. syntax * Generates Form Widgets. * Virtual fields. Designers / Front-end engineers Editors
  • 40.
    Template Management Template Example <ul class="home_links"> <li> <ul> <snippet:eachArticle config: { name: enlace_articulo_moda }> <li><a href="<?php echo $record->url ?>"> <?php echo $record->getTitle() ?> </a></li> </snippet:eachArticle> </ul> <p><a href="/moda"> ver todas las noticias de 'moda'</a></p> </li> <li>
  • 41.
  • 43.
    Other Features andtools ● User Management and permissions (sfGuardUser) ● Comments Moderation ● Custom data models (sport standings, real state listings...) ● Sphinx search ● External Feeds ● Git
  • 44.
    Infraestructure Web Users Internet Load Balancer Web Server 1 Web Server 2 Multiservice Backend Write Queries Read Queries Master DB Slave DB
  • 45.
    Performance $timer = sfTimerManager::getTimer('myTimer'); // Do things ● Symfony timer ... // Stop the timer and add the elapsed time $timer->addTime(); // Get the result (and stop the timer if not already stopped) $elapsedTime = $timer->getElapsedTime(); ● Routing cache in versions 1.2.x
  • 46.
    Performance ● Doctrine Query and Results cache ● Control Hydrations Cache Manager ● Symfony View Cache Load Testing ● Memcached
  • 47.
    delivery and acceptance ● Maintenance is another topic, will the final customer/users need it. ● Identify what to maintain from the beginning (infraestructure, templating, design...) ● Many times, you'll find yourself maintaining not being able to leave the project! Plan acceptance
  • 48.
    Some Clients feedback ● “I expected bugs!! Where are they?” (Or where are they in the planification?) ● “I expected a traffic drop. It is increasing since first day!!” ● “Symfony is slow? My site is fast!!” - Many times performance issues are not in the framework or language (PHP) itself.
  • 49.
  • 50.
    Thanks! reach me @ my company: http://www.acilia.es blog: http://www.quevidaesta.com twitter: http://twitter.com/esmiz mail: marcos@acilia.es