Skip to content

If you last used PHP to put a contact form on a website, you might be surprised by what you can write today. PHP can enforce a typed function signature, and Laravel can keep a booted application in memory between requests. The dollar signs are still there. The runtime is still free.

Start with a function that accepts or rejects a numeric string depending on the calling file. Then measure the same Laravel app in two serving modes and watch one change to the database query remove forty queries from a request. Along the way, you’ll see why some old criticisms still matter and how to recognise them in the code you maintain.

Read the chapters in order or jump to a claim you’ve heard. Run the series examples with PHP 8.6 or later from a local checkout of Code with PHP. The Laravel chapters use a separate Laravel 13 app, with Composer and SQLite. Only the performance lab needs FrankenPHP and ApacheBench.

  1. PHP can’t be typed — Compare runtime checks, caller-side strictness and static analysis.
  2. PHP is always slow — Work out where OPcache, JIT and PHP-FPM fit into a request.
  3. Laravel is too slow for production — Measure Octane with FrankenPHP and change the shape of a database query.
  4. PHP code is always messy — Follow a Laravel quote through validation, pricing and tests.
  1. PHP is old and dead — Check the support calendar and run an enum with a property hook.
  2. PHP is expensive because it’s full of dollar signs — Read PHP’s variable syntax and calculate the cost of running an app.
  3. PHP is only for WordPress — Run one inventory report as a command and as a JSON endpoint.
  1. PHP is inherently insecure — Trace a request through validation, authorisation, the database and the response.
  2. PHP can’t scale — Follow a Laravel application as it grows from one server to three.
  3. PHP can’t do concurrency — Run a Fiber and choose between concurrent requests, parallel I/O and a queue.
  4. PHP has no serious developer tools — Check a Laravel feature with Composer, Pint, Larastan and PHPUnit.
  5. PHP’s old quirks explain everything about it — Try the comparisons, return values and arrays that still surprise developers.
  6. Legacy PHP always needs a rewrite — Capture existing behaviour and plan a PHP upgrade in stages.