A view of the sunset, as seen from Vimeo’s headquarters in NYC
A view of the sunset, as seen from Vimeo’s headquarters in NYC

Before I joined Vimeo in 2014 my PHP code had not been scrutinised by other humans, and it was an enlightening experience. I discovered I was reasonably good at writing PHP, but a little subpar when it came to catching bugs before my code entered production.

I experienced another early revelation at Vimeo: I really enjoyed improving the development experience for my colleagues via custom tooling. These two discoveries lead to the creation of Psalm, a tool I created to help us avoid bugs in production.

I’ve spent most of my time at Vimeo flitting between working on our large…


The unholy mix of an elephant and a dolphin leaps out the water
The unholy mix of an elephant and a dolphin leaps out the water

If you have a web-based application, chances are high that it uses some sort of database to store information. Chances are also high that you’ll want to test that application somehow. One of the questions you then have to answer is, “How do I test something that queries a database?”

Option 1: Limit database interaction to a mockable API

A tempting first step is to mock out high-level API calls. If you have a getCurrentUser method, a mock can ensure that method returns an object with appropriate data.

This is fine for some simple CRUD applications, but becomes an issue when you want to use MySQL features beyond simple…


Small people cleaning up the PHP logo
Small people cleaning up the PHP logo

In the last year, Vimeo developers have written backend code in lots of languages — PHP, Go, Ruby, Python, NodeJS, Java, C, C++, and a bit of Rust.

In 2004, we started with just one: PHP. It was an ideal language for brand-new startups like Vimeo. PHP’s interpreter enabled entrepreneurs to develop prototypes rapidly, and it came with a large standard library that took the hassle out of common tasks like sending emails and accessing databases.

Most startups fail, but some PHP-based startups were still around ten years later. A few had achieved meteoric growth, and some of those (most…


Today I’m releasing a Psalm plugin for Laravel!

Background

Two months ago I announced the latest version of Psalm, and discussed how its new plugin framework would make authoring integrations for third-party packages much easier. A bunch of great plugins have sprung up since, but none for Laravel.

Authoring a such a plugin from scratch requires an in-depth knowledge of that framework. Nobody came forward to volunteer, and my own experience with Laravel is essentially zero.

Luckily there’s a popular tool that’s done most of the work already: the Laravel IDE Helper. …


This guide discusses functionality available in two PHP static analysis tools: Psalm (from Vimeo), and Phan. PHPStan has plans to support templated types in an upcoming version.

At a former job I wrote a load of C# code, and I really enjoyed playing around with generic classes. You could write code like…

class LazyList<T> : IEnumerable<T> { ... }...var list = new LazyList<Foo>(ids);
foreach (var value in list) {}

…and know that value inside the loop has the type Foo. …


With apologies to Rubens

TL;DR: Psalm is a PHP static analysis tool that’s designed to improve large codebases by identifying both obvious and hard-to-spot bugs through the inference of types. The new update makes Psalm faster, brings a new Composer-based plugin framework, and adds baseline generation, IDE support, and more.

Psalm exists because we realized we needed it at Vimeo. It was open-sourced a year later because we thought that others might appreciate it, too. Working on it has been a fascinating experience — when I began I’d never talked to a PHP developer outside Vimeo. …


When PHP 5.2.4 was released in August 2007, the world was reading the last instalment of the Harry Potter series, watching Transformers in theatres, and following a junior senator from Illinois as he embarked on his outsider bid for the US presidency.

Now it’s 2018. Harry Potter’s son is ending his first year at Hogwarts, the Transformers have saved the world four more times, and that junior senator is now enjoying his third term as President of the United States. [Editor’s note: unable to verify]

But most importantly, the current version of WordPress, the world’s most popular PHP application, still…


In June of 2015, the Vimeo Codebase was large, sprawling, and full of magic. It processed many millions of requests every hour. The users were happy, and the company grew.

The Codebase worked.

The Codebase didn’t have many tests or much documentation. The only practical way to figure out whether changing one file was going to break code elsewhere on Vimeo was to deploy it to production, cross your fingers, and be ready to roll back.

Engineers seldom changed existing methods drastically, opting for the safety of a brand new method. …


Recently, we released a tool called Psalm that’s designed to check PHP code for potential errors. We use it at Vimeo as part of our build process, and it helps us stop bugs from making it into production code.

A number of similar tools exist for dynamically typed languages:

  • Hack (created by Facebook) has an OCaml-based type-checker that does an excellent job of analysing that language’s PHP-like syntax.
  • TypeScript (Microsoft) and Flow (also Facebook) are great for checking a Javascript-like syntax.
  • For PHP code: Phan (from Etsy) and PhpStan.

Psalm is designed to have a better understanding of the codebase…

Matt Brown

I work at Slack. I am cool.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store