The PHP Project Guide

Retired

This book is no longer available for sale.

The PHP Project Guide

About the Book

Most programming books will teach you the basics of the language, run through some example applications, filling the pages up with code that could become obsolete in future. Looking at code isn't always a great way to learn.

This book aims to combat that by providing a guide to PHP that will directly affect how you address, build and maintain websites.

Less code, more advice!

About the Author

Alex Garrett
Alex Garrett

I'm a web developer and founder of phpacademy. You can find out more at http://itsmealex.com

Table of Contents

  • 1 Introduction
    • 1.1 Typical programming books are hard to learn from
  • 2 Who this book is for
  • 3 What you should get from reading this book
  • 4 Errata
  • 5 Useful notations
  • 6 Starting a project
    • 6.1 Project examples
    • 6.2 What you don’t need
    • 6.3 Taking the first steps
      • But what if I just want to learn?
    • 6.4 How long should a project take?
  • 7 File structure
    • 7.1 Why does file structure matter?
    • 7.2 Planning your file structure
    • 7.3 Naming files
    • 7.4 Watch your extension
    • 7.5 Organising classes
  • 8 Development environment
    • 8.1 Choosing a text editor
    • 8.2 Development envionment settings
    • 8.3 Version control software
      • Git
        • GitHub
  • 9 Frameworks
    • 9.1 What’s a framework?
    • 9.2 More about MVC
    • 9.3 Don’t repeat yourself!
    • 9.4 What a framework won’t do
    • 9.5 The benefits of using a framework
    • 9.6 The drawbacks of using a framework
    • 9.7 So what next?
  • 10 Following coding standards
    • 10.1 Zend Coding Standard
    • 10.2 Your own coding style
      • Sort your existing code with a code beautifier
    • 10.3 The heredoc syntax
    • 10.4 Confused about what to do?
  • 11 Frontend design
    • 11.1 What about while learning?
    • 11.2 Learning for the frontend
    • 11.3 Cutting up your template
    • 11.4 Embrace MVC
    • 11.5 Template engines
  • 12 Procedural or Object Oriented?
    • 12.1 What is Object Oriented Programming?
    • 12.2 Tips for learning and retaining
    • 12.3 But what about functions?
    • 12.4 Is it ok not to use OOP?
    • 12.5 Examples in practice
      • Database handler
    • 12.6 User class
    • 12.7 Grasping OOP
    • 12.8 Recommended reading
  • 13 Databases
    • 13.1 phpMyAdmin
    • 13.2 Planning your database
    • 13.3 PDO
    • 13.4 Choosing how to communicate with your database
    • 13.5 Interacting with your database
    • 13.6 A Guestbook example
  • 14 Generic functionality and configuration
    • 14.1 Global configuration
    • 14.2 Database based configuration
    • 14.3 Generic data output
    • 14.4 Translations
    • 14.5 Translating other site content
  • 15 Commenting code
  • 16 PHP Documentation
    • 16.1 Finding what you need
    • 16.2 Deprecated functions
    • 16.3 Cautions
    • 16.4 Browsing for help
  • 17 Speed
    • 17.1 A method for testing your page server load time
    • 17.2 HTML, CSS, JavaScript and other HTTP Requests
      • Reducing HTML/CSS/JavaScript file size
    • 17.3 Loading resources from a CDN
    • 17.4 Rendering time
    • 17.5 Limit queries
    • 17.6 Optimise queries
    • 17.7 MySQL or PHP functions?
    • 17.8 Searching a database
      • Add a fulltext index
      • Use a search server
    • 17.9 Looping
    • 17.10 File reading
    • 17.11 Limiting user defined values
    • 17.12 Caching
      • PHP Accelerators
        • Memcached
        • eAccelerator
        • APC
    • 17.13 Caching AJAX requests
  • 18 Security
    • 18.1 Why no website is secure
    • 18.2 Security first
    • 18.3 What else?
    • 18.4 Back up
    • 18.5 SQL Injection
    • 18.6 Magic Quotes
    • 18.7 Session and cookie security
      • Where are sessions stored?
    • 18.8 CSRF (Cross Site Request Forgery)
    • 18.9 Include/require security
    • 18.10 File traversal
    • 18.11 Important considerations
    • 18.12 Error reporting
    • 18.13 error_log
    • 18.14 Passwords
    • 18.15 You online
    • 18.16 What next?
    • 18.17 Recommended reading
  • 19 Ideas
    • 19.1 Coming up with an idea
    • 19.2 Monetizing
    • 19.3 Get feedback
    • 19.4 Start small
    • 19.5 Recommended reading
  • 20 Examples
    • 20.1 Building a forum
      • User authentication
      • Category listing
      • Listing topics within a category
      • Posts within topics
      • New topics and replying to topics
    • 20.2 Pagination
    • 20.3 AJAX Content
      • Simple processing of data
  • 21 Hosting your website
    • 21.1 Choosing a host
      • Security
      • Configuration
      • Speed
    • 21.2 Webserver configuration
    • 21.3 PHP configuration
    • 21.4 Dedicated server
  • 22 How to learn
    • 22.1 Stick with it
    • 22.2 Teaching
    • 22.3 Books don’t always help
    • 22.4 It’ll click
    • 22.5 Starting a project
  • 23 The end
      • This book is a work in progress

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub