Skip to content
Companion code repository for Modern PHP by Josh Lockhart
JavaScript HTML PHP CSS Ruby
Branch: master
Clone or download

Latest commit


Type Name Latest commit message Commit time
Failed to load latest commit information.
02-features Update standards/psr3 component versions Jan 23, 2016
03-standards Update standards/psr3 component versions Jan 23, 2016
05-good-practices Database code examples Dec 13, 2014
09-deployment Add deployment app example Dec 14, 2014
10-testing Add chapter 10 code Dec 14, 2014
LICENSE Update license Jan 26, 2015 Link PHP The Right Way in README Jan 27, 2015

Modern PHP

This is the companion code repository for Modern PHP by Josh Lockhart (O’Reilly).

About the Book

The PHP language is different than you remember. No longer just about procedural code and monolithic frameworks, PHP has experienced a renaissance to become a full-featured, mature language with object-orientation, namespaces, and a growing collection of reusable component libraries.

Modern PHP reveals these new language features in action. Author Josh Lockhart—creator of PHP The Right Way, a popular community initiative—shows you how to develop PHP applications using best practices for application architecture and planning, databases, security, testing, debugging, and deployment.

  • Learn detailed, practical techniques that you can immediately implement in your PHP project
  • Grow your PHP skillset with the newest language features and modern best practices
  • Get up to speed on new language features of PHP 5.x (OOP, DateTime, namespaces, traits, and more)
  • Discover the latest from the PHP community, including what's new with the Hack programming language and the HipHop Virtual Machine (HHVM)
  • Find out how the new PHP has become a more mature language with community standards, a growing affinity for interoperable components, and a passionate community committed to improving performance.
Modern PHP
Josh Lockhart
O'Reilly Media
Print, Safari Books Online
February 2015 (est.)
258 (est.)
Print ISBN
978-1-4919-0501-2 | ISBN 10:1-4919-0501-8

About this Repository

Each chapter has its own repository directory, and directory contents are organized according to the chapter's content. I've tried to name each code file according to its related Figure ID in the book.

About the Author

Josh Lockhart created the Slim Framework, a popular PHP micro framework that enables rapid web application and API development. Josh also started and currently curates PHP The Right Way, a popular initiative in the PHP community that encourages good practices and disseminates quality information for PHP developers around the world.

Josh is a developer at New Media Campaigns—a full service web design, development, and marketing agency in Carrboro, North Carolina—where he enjoys building custom applications with HTML, CSS, PHP, JavaScript, Bash, and various content management frameworks.

Josh graduated from the Information and Library Science program at the University of North Carolina at Chapel Hill in 2008. He currently resides in Chapel Hill, North Carolina with his wonderful wife, Laurel, and their two dogs.

You can follow Josh on Twitter, read his blog, and track his open source projects on GitHub.

Code License and Permission

This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission. We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Modern PHP by Josh Lockhart (O’Reilly). Copyright 2015 Josh Lockhart, 978-1-491-90501-2.” If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at

Safari® Books Online

Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business.

Technology professionals, software developers, web designers, and business and crea‐ tive professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.

Safari Books Online offers a range of plans and pricing for enterprise, government, education, and individuals.

Members have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kauf‐ mann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more information about Safari Books Online, please visit us online.

You can’t perform that action at this time.