Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Treehouse

PHP Standards and Best Practices Course (How To)

via Treehouse

Overview

PHP is a flexible language with a long history. Being such a popular language for so long means there is a lot of code out there. There are many ways to program in PHP, and not all of them are as safe, performant, or maintainable as some of the older educational materials might have you believe.

Having so many options can be daunting to many developers as they grow from beginner to intermediate. Fortunately there are established best practices out there, and this course will help you learn about many of them.

What you'll learn

  • Databases
  • International Concerns
  • Distributing and Loading Code
  • Error Handling

Syllabus

Why Do We Need Best Practices?

This is an intermediate course designed to teach best practices and standards to those who already know how to program PHP at a basic level.

Chevron 3 steps
  • Introduction

    1:38

  • History

    1:09

  • Starting Right

    2 questions

Databases and International Concerns

This stage helps to cover a few topics that are generally covered elsewhere with extremely outdated information, which these days is possible to do much more easily with core classes and functions in PHP.

Chevron 10 steps
  • Choosing a Database Extension

    1:34

  • Choosing a database extension

    3 questions

  • Working with DateTime

    4:21

  • Review: Working with DateTime

    3 questions

  • DateTime Comparisons

    2:33

  • DateTime Comparisons

    3 questions

  • Understanding Time Zones

    3:56

  • Understanding Timezones

    3 questions

  • Understanding UTF-8

    4:14

  • Understanding UTF-8

    3 questions

Autoloading and Composer

One important area for understanding best practices and standards is the area of distributing (sharing code), and using other shared code.

Chevron 7 steps
  • Introduction

    1:14

  • Namespaces

    2:18

  • Review: Namespaces

    3 questions

  • Autoloading

    3:03

  • Autoloading

    3 questions

  • Composer

    6:06

  • Composer

    3 questions

Creating Distributable OOP Packages

Learn how packages are distributed and how you can package your code to be used by other developers.

Chevron 9 steps
  • Creating Components

    2:26

  • Review: Component Structure

    4 questions

  • PSR-1

    4:49

  • Review: PSR-1

    3 questions

  • PSR-2

    10:28

  • Review: PSR-2

    4 questions

  • Composer Metadata

    4:47

  • Semantic Versioning

    2:49

  • Review: Composer Metadata

    3 questions

Error Handling

PHP has the idea of “errors” which are different to “exceptions” and that can be very handy in production environments if you know how they work, but can lead to a little confusion if you expect things to work differently.

Chevron 8 steps
  • Errors

    4:30

  • Review: Errors

    3 questions

  • Exceptions

    7:26

  • Review: Exceptions

    5 questions

  • Converting errors to exceptions

    4:30

  • Review: Converting Errors to Exceptions

    3 questions

  • Logging with PSR-3

    6:30

  • Review: Converting Errors to Exceptions

    3 questions

Taught by

Phil Sturgeon

Reviews

Start your review of PHP Standards and Best Practices Course (How To)

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.