8. Dependency Management

There are a ton of PHP libraries, frameworks, and components to choose from. Your project will likely use several of them — these are project dependencies. PHP did not have a good way to manage these project dependencies. Even if you managed them manually, you still had to worry about autoloaders. That is no longer an issue.

Currently there are two major package management systems for PHP - Composer and PEAR. Composer is currently the most popular package manager for PHP, however for a long time PEAR was the primary package manager in use. Knowing PEAR’s history is a good idea, since you may still find references to it even if you never use it.

8.1 Books

There are many PHP books; sadly some are now quite old and no longer accurate. In particular, avoid books on “PHP 6”, a version that will now never exist. The next major release of PHP after 5.6 was “PHP 7”, partly because of this.

This section aims to be a living document for recommended books on PHP development in general. If you would like your book to be added, send a PR and it will be reviewed for relevancy.

Free Books

Paid Books

  • PHP & MySQL - PHP book with excellent illustrations that covers all the fundamentals of PHP and MySQL with practical examples.
  • Build APIs You Won’t Hate - Everyone and their dog wants an API, so you should probably learn how to build them.
  • Modern PHP - Covers modern PHP features, best practices, testing, tuning, deployment and setting up a dev environment.
  • Building Secure PHP Apps - Learn the security basics that a senior developer usually acquires over years of experience, all condensed down into one quick and easy handbook.
  • Modernizing Legacy Applications In PHP - Get your code under control in a series of small, specific steps.
  • Securing PHP: Core Concepts - A guide to some of the most common security terms and provides some examples of them in every day PHP.
  • Scaling PHP - Stop playing sysadmin and get back to coding.
  • Signaling PHP - PCNLT signals are a great help when writing PHP scripts that run from the command line.
  • Minimum Viable Tests - Long-time PHP testing evangelist Chris Hartjes goes over what he feels is the minimum you need to know to get started.
  • Domain-Driven Design in PHP - See real examples written in PHP showcasing Domain-Driven Design Architectural Styles (Hexagonal Architecture, CQRS or Event Sourcing), Tactical Design Patterns, and Bounded Context Integration.

8.2 People to Follow

It’s difficult to find interesting and knowledgeable PHP community members when you are first starting out. You can find an abbreviated list of PHP community members to get you started at:

8.3 Other Useful Resources

Cheatsheets

  • PHP Cheatsheets - for variable comparisons, arithmetics and variable testing in various PHP versions.
  • Modern PHP Cheatsheet - documents modern (PHP 7.0+) idioms in a unified document.
  • OWASP Security Cheatsheets - provides a concise collection of high value information on specific application security topics.

More best practices

News around the PHP and web development communities

You can subscribe to weekly newsletters to keep yourself informed on new libraries, latest news, events and general announcements, as well as additional resources being published every now and then:

There are also Weeklies on other platforms you might be interested in; here’s a list of some.

PHP universe

8.4 Video Tutorials

YouTube Channels

Paid Videos

8.5 Components

As mentioned above “Components” are another approach to the common goal of creating, distributing and implementing shared code. Various component repositories exist, the main two of which are:

Both of these repositories have command line tools associated with them to help the installation and upgrade processes, and have been explained in more detail in the Dependency Management section.

There are also component-based frameworks and component-vendors that offer no framework at all. These projects provide another source of packages which ideally have little to no dependencies on other packages, or specific frameworks.

For example, you can use the FuelPHP Validation package, without needing to use the FuelPHP framework itself.

Laravel’s Illuminate components will become better decoupled from the Laravel framework. For now, only the components best decoupled from the Laravel framework are listed above.

8.6 PHP PaaS Providers