PHP 5 CMS Framework Development - 2nd Edition

PHP 5 CMS Framework Development - 2nd Edition
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Learn about the design choices involved in the creation of advanced web oriented PHP systems
  • Build an infrastructure for web applications that provides high functionality while avoiding pre-empting styling choices
  • Implement solid mechanisms for common features such as menus, presentation services, user management, and more
  • Written by a seasoned developer of CMS applications and other modern software


Book Details

Language : English
Paperback : 416 pages [ 235mm x 191mm ]
Release Date : August 2010
ISBN : 1849511349
ISBN 13 : 9781849511346
Author(s) : Martin Brampton
Topics and Technologies : All Books, Web Development, Content Management (CMS), Open Source, PHP

Table of Contents

Chapter 1: CMS Architecture
Chapter 2: Organizing Code
Chapter 3: Database and Data Objects
Chapter 4: Administrators, Users, and Guests
Chapter 5: Sessions and Users
Chapter 6: Caches and Handlers
Chapter 7: Access Control
Chapter 8: Handling Extensions
Chapter 9: Menus
Chapter 10: Languages
Chapter 11: Presentation Services
Chapter 12: Other Services
Chapter 13: SEF and RESTful Services
Chapter 14: Error Handling
Chapter 15: Real Content
Appendix A: Packaging Extensions
Appendix B: Packaging XML Example
  • Chapter 1: CMS Architecture
    • The idea of a CMS
      • Critical CMS features
      • Desirable CMS features
      • System management
    • Technology for CMS building
      • Leveraging PHP5
      • Some PHP policies
      • Globalness in PHP
      • Classes and objects
      • Objects, patterns, and refactoring
      • The object-relational compromise
      • Basics of combining PHP and XHTML
      • Model, view, and controller
    • The CMS environment
      • Hosting the CMS
      • Basic browser matters
      • Security of a CMS
      • Some CMS terminology
    • Summary
  • Chapter 2: Organizing Code
    • The problem
    • Discussion and considerations
      • Security
      • Methods of code inclusion
      • Practicality in coding
    • Exploring PHP and object design
      • Autoloading
      • Namespaces and class visibility
      • Singletons
        • Objections to use of singletons
    • Framework solution
      • Autoloading
      • Finding a path to the class
      • Populating the dynamic class map
      • Saving map elements
        • Obtaining class information
    • Summary
  • Chapter 3: Database and Data Objects
    • The problem
    • Discussion and considerations
      • Database dependency
      • The role of the database
      • Level of database abstraction
      • Ease of development
      • Keeping up with change
      • Database security
      • Pragmatic error handling
    • Exploring PHP—indirect references
    • Framework solution
      • Class structure
        • Connecting to a database
      • Handling databases easily
        • Prefixing table names in SQL
        • Making the database work
        • Getting hold of data
        • Higher level data access
        • Assisted update and insert
        • What happened?
      • Database extended services
        • Getting data about data
        • Easier data about data
        • Aiding maintenance
      • Data objects
        • Rudimentary data object methods
        • Data object input and output
        • Setting data in data objects
        • Sequencing database rows
      • Database maintenance utility
    • Summary
  • Chapter 4: Administrators, Users, and Guests
    • The problem
    • Discussion and considerations
      • Who needs users?
      • Secure authentication
      • Secure storage of passwords
      • Blocking SQL injection
      • Login
      • Managing user data
      • User self service
      • Customizing for users
      • Extended user information
    • Exploring PHP—arrays and SQL
    • Framework solution
      • The user database table
      • Indexes on users
      • Keeping user tables in step
      • Achieving login
      • Administering users
      • Generating passwords
    • Summary
  • Chapter 5: Sessions and Users
    • The problem
    • Discussion and considerations
      • Why sessions?
      • How sessions work
      • Avoiding session vulnerabilities
      • Search engine bots
    • Session data and scalability
    • Exploring PHP—frameworks of classes
    • Framework solution
      • Building a session handler
    • Creating a session
      • Finding the IP address
      • Validating a session
      • Remembering users
      • Completing session handling
      • Session data
      • Session data and bots
      • Retrieving session data
    • Keeping session data tidy
    • Summary
  • Chapter 6: Caches and Handlers
    • Discussion and considerations
      • Why build information handlers?
      • The singleton cache
        • The disk cache
        • Scalability and database cache
      • The XHTML cache
      • Other caches
    • Exploring PHP—static elements and helpers
      • Abstract cache class
      • Creating the base class cached singleton
      • Generalized cache
    • Summary
  • Chapter 7: Access Control
    • The problem
    • Discussion and considerations
      • Adding hierarchy
      • Adding constraints
      • Avoiding unnecessary restrictions
      • Some special roles
      • Implementation efficiency
      • Where are the real difficulties?
    • Exploring SQL—MySQL and PHP
    • Framework solution
      • Database for RBAC
      • Administering RBAC
      • The general RBAC cache
      • Asking RBAC questions
    • Summary
  • Chapter 8: Handling Extensions
    • The problem
    • Discussion and considerations
      • An extension ecosystem
        • Templates in the ecosystem
        • Modules in the ecosystem
        • Components in the ecosystem
        • Component templates
        • Modules everywhere
      • More on extensions
        • Templates
        • Modules
        • Components
        • Plugins
      • Extension parameters
    • Exploring PHP—XML handling
    • Framework solution
      • Packaging extensions
      • Module interface and structure
      • The logic of module activation
      • Component interface and structure
        • A standardized component structure
      • Plugin interface and structure
      • Invoking plugins
      • Applications
      • Installing and managing extensions
        • Structuring installer tasks
        • Putting extension files in place
        • Extensions and the database
        • Knowing about extension classes
    • Summary
  • Chapter 9: Menus
    • The problem
    • Discussion and considerations
      • Page management by URI
      • Menu database requirements
      • Menu management
      • Menu construction
      • Menu presentation
    • Exploring PHP—array functions
    • Framework solution
      • Building the menu handler
      • Interfacing to components
      • The menu creator
      • An example of a menu module
    • Summary
  • Chapter 10: Languages
    • The problem
    • Discussion and considerations
      • Character sets
      • UTF-8 and XHTML
      • Specifying languages
      • Handling multiple languages in code
      • Languages in CMS extensions
      • Handling languages in data
    • Exploring PHP—character sets
    • Framework solution
      • The gettext implementation
        • File formats for gettext
        • Functions for gettext
        • The PHPgettext classes
        • The language class
        • Administrator language application
      • Handling extensions
        • Managing extension translations
        • Installing translations with CMS extensions
        • Handling multilingual data
    • Summary
  • Chapter 11: Presentation Services
    • The problem
    • Discussion and considerations
      • Differing points of view
      • Model View Controller
      • XHTML, CSS, and themes
      • PHP for XHTML creation
      • GUI widgets and XHTML
      • Page control and navigation
      • WYSIWYG editors
      • XHTML cleaning
      • The administrator interface
    • Exploring PHP—clarity and succinctness
    • Framework solution
      • Using "heredoc" to define XHTML
      • Using templating engines
      • Some widgets
      • Building page control
      • Supporting editors
      • Cleaning up XHTML
      • Administrator database management
      • Customization through subclassing
    • Summary
  • Chapter 12: Other Services
    • The problem
    • Discussion and considerations
      • Parsing XML
      • Configuration handling
      • WYSIWYG editing
      • File and directory handling
      • Sending mail
      • Parameter objects
      • Administrator ready-made functionality
      • Exploring PHP—file issues in web hosting
        • Basic file and directory permissions
        • Hosting and ownership
        • Living with split ownership
        • Avoiding split ownership
    • Framework solution
      • Reading XML files easily
      • Storing configuration data
      • Incorporating a WYSIWYG editor
      • Dealing with files and directories
      • Compound parameter objects
      • Administrator ready-made table handlers
    • Summary
  • Chapter 13: SEF and RESTful Services
    • The problem
    • Discussion
      • Transforming query strings
      • Direct URI handling and REST
      • Mechanics of URI handling
      • Essential HTTP result codes
      • The importance of metadata
      • Exploring PHP—PHP and HTTP
    • Framework solution
      • Efficient lookup of very long keys
      • Cache and database transformation
      • Looking at SEF transformation code
        • Decoding an incoming URI
        • Encoding an outgoing URI
      • Direct URI handling
        • The future of direct URIs
    • Summary
  • Chapter 14: Error Handling
    • The problem
    • Discussion
      • PHP error handling
      • Database errors
      • Application errors
      • Exploring PHP—error handling
    • Framework solution
      • Handling database errors
      • 404 and 403 errors
    • Summary
  • Chapter 15: Real Content
    • The problem
    • Discussion and considerations
      • Articles, blogs, magazines, and FAQ
      • Comments and reviews
      • Forums
      • Galleries, repositories, and streaming
      • E-commerce and payments
      • Forms
      • Calendars
      • Integrators
      • RSS readers
      • Other categories
      • Exploring technology—accessibility
        • General good practice
        • Use of JavaScript
        • Validation
    • Framework solution
      • A simple blog application
        • The database table for blog
        • A blog data object
        • Administering blog items—controller
        • Administering blog items—viewer
        • Showing blogs to visitors
        • Menu building
    • Summary

Martin Brampton

Now primarily a software developer and writer, Martin Brampton started out studying mathematics at Cambridge University. He then spent a number of years helping to create the so-called legacy, which remained in use far longer than he ever expected. He worked on a variety of major systems in areas like banking and insurance, spiced with occasional forays into technical areas such as cargo ship hull design and natural gas pipeline telemetry.

After a decade of heading IT for an accountancy firm, a few years as a director of a leading analyst firm, and an MA degree in Modern European Philosophy, Martin finally returned to his interest in software, but this time transformed into web applications. He found PHP5, which fits well with his prejudice in favor of programming languages that are interpreted and strongly object oriented.

Utilizing PHP, Martin took on development of useful extensions for the Mambo (and now also Joomla!) systems, then became leader of the team developing Mambo itself. More recently, he has written a complete new generation CMS named Aliro, many aspects of which are described in this book. He has also created a common API to enable add-on applications to be written with a single code base for Aliro, Joomla (1.0 and 1.5) and Mambo.

All in all, Martin is now interested in many aspects of web development and hosting; he consequently has little spare time. But his focus remains on object oriented software with a web slant, much of which is open source. He runs Black Sheep Research, which provides software, speaking and writing services, and also manages web servers for himself and his clients.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

PHP 5 CMS Framework Development - 2nd Edition +    Oracle Application Express 4.0 with Ext JS =
50% Off
the second eBook
Price for both: £27.35

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Effective coding techniques, illustrated through examples of key parts of sample solutions, along with detailed explanations.
  • Object architectures to fully exploit PHP 5 in advanced systems
  • A foundation for database processing to ease further development
  • Technical functions such as handling user sessions and the efficient creation and use of caches
  • How to support add-on applications to extend the main framework
  • Flexible and efficient ways to deal with supporting different world languages
  • Reviews and practical solutions for topics including XML handling, configuration management, editing, file system interfaces, mail, spam, timed operations and parameter objects
  • Transforming query string URLs to be more “friendly” both for people and search engines
  • Alternative ways to deal with presentation services, including discussion of MVC (model-view-controller)


In Detail

If you want an insight into the critical design issues and programming techniques required for a web oriented framework in PHP5, this book will be invaluable. Whether you want to build your own CMS style framework, want to understand how such frameworks are created, or simply want to review advanced PHP5 software development techniques, this book is for you.

As a former development team leader on the renowned Mambo open-source content management system, author Martin Brampton offers unique insight and practical guidance into the problem of building an architecture for a web oriented framework or content management system, using the latest versions of popular web scripting language PHP.

The scene-setting first chapter describes the evolution of PHP frameworks designed to support web sites by acting as content management systems. It reviews the critical and desirable features of such systems, followed by an overview of the technology and a review of the technical environment.
Following chapters look at particular topics, with:
• A concise statement of the problem
• Discussion of the important design issues and problems faced
• Creation of the framework solution

At every point, there is an emphasis on effectiveness, efficiency and security – all vital attributes for sound web systems. By and large these are achieved through thoughtful design and careful implementation.

Early chapters look at the best ways to handle some fundamental issues such as the automatic loading of code modules and interfaces to database systems. Digging deeper into the problems that are driven by web requirements, following chapters go deeply into session handling, caches, and access control.

New for this edition is a chapter discussing the transformation of URLs to turn ugly query strings into readable strings that are believed to be more “search engine friendly” and are certainly more user friendly. This topic is then extended into a review of ways to handle “friendly” URLs without going through query strings, and how to build RESTful interfaces.

The final chapter discusses the key issues that affect a wide range of specific content handlers and explores a practical example in detail.

This book takes you through the creation of a working architecture for a PHP 5-based framework for web applications, stepping you through the design and major implementation issues, right through to explanations of working code examples


The book includes extensive discussion of the design issues, and how to overcome them in the framework. Each chapter of the book focuses on a particular requirement of the framework. The book will not present the total code for a framework, which requires many thousands of lines. But it does show the parts that raise critical design or implementation issues. For these, detailed explanation is given, leaving the less problematic parts to the code download itself.

Who this book is for

If you are a professional PHP developer who wants to know more about web oriented frameworks and content management systems, this book is for you. Whether you already use an in-house developed framework or are developing one, or if you are simply interested in the issues involved in this demanding area, you will find discussion ranging from design issues to detailed coding solutions in this book.
You are expected to have experience working with PHP 5 object-oriented programming. Examples in the book will run on any recent version of PHP 5, including 5.3.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software