Skip to content

Your PHP application has no documentation? Here’s how it can still be taken over

Nobody knows exactly how your application works anymore. Every small change feels like a risk, maybe a vendor has already turned you down, and the knowledge seems to have left with the previous developer. “There’s no documentation” is the most common sentence at the start of a takeover, but it’s rarely entirely true: the knowledge is in the code, in the version history, in the database, on the server and in your people’s heads. In five steps, it becomes an application you have under control again.

By Dimitri König3 min read

A running PHP application documents itself, in a way. When you take over an application without documentation, the task is to gather that scattered knowledge and write it down.

Where is the knowledge about an application when there are no docs?

  • In the code: Routes, controllers, models and configuration show what the application does.
  • In the version history: Commit messages and changes explain why something was built the way it was.
  • In the database: Tables, relationships and data volumes show what is actually used.
  • On the server: Cron jobs, web server configuration, environment variables and logs show what runs in the background.
  • With your people: Whoever works with the application every day knows the workflows, special cases and known quirks.

How much can be recovered from a running system without documentation is shown by a Unique-P project in which the old CMS offered neither an API nor direct database access. A custom-built scraper captured the entire website with thousands of pages, including hierarchy, media and translations, and transferred it to TYPO3 fully automatically: automated CMS migration to TYPO3.

How an undocumented PHP application becomes manageable in five steps

  1. Create an inventory. PHP version, framework and its version, dependencies according to composer.json and composer.lock, database, server, external services. The result is a list that shows you what you’re dealing with.
  2. Set up a working copy. The application runs in a test environment with the same PHP version as in production, where its behavior can be examined without risk. Personal data there is anonymized, so the test environment also stays unproblematic under the Swiss Federal Act on Data Protection (FADP).
  3. Map entry points and data flows. Which pages and interfaces exist, which cron jobs and queues run, which data flows from where to where? This shows everything a change can affect.
  4. Secure critical workflows with tests. Characterization tests record how ordering, login or data import behave today. From then on, every unintended change shows up immediately. How such a before-and-after comparison works in a PHP upgrade is covered in the article PHP upgrade without tests.
  5. Let the documentation grow along the way. Everything the inventory, test environment, data flows and tests bring to light ends up in the repository. That way, the documentation isn’t created as an extra project but as a by-product of the work.

What documentation does an application need after a takeover?

Document Contents For whom
README Setup, running locally, key commands Anyone who works on the code
Operations manual Deployment, backups, cron jobs, monitoring, emergency procedure Operations and support
Interface overview External services, data flows, access (without passwords) Development and the business department
Architecture overview Structure, main components, known weaknesses Development and decision-makers
Decision log Why something was built or changed the way it was Everyone who makes decisions later

The decision log follows Michael Nygard’s idea of Architecture Decision Records: short, dated entries that record which decision was made and why.

How do you keep your application from ending up without documentation again?

The real problem of an undocumented application isn’t the missing documentation, but the dependence on a single person. That’s why, after a takeover by Unique-P, code and documentation live in your company’s repository, and all credentials in a shared password vault. That way, someone else can take over at any time, even without me.

With ongoing maintenance from Unique-P, the documentation of a taken-over application grows with every change instead of going stale again. The web application takeover page shows how to get started. What else matters with a half-finished project or AI-generated code is covered in the article taking over an unfinished project.

Sources

  1. [1]Characterization test · Wikipedia
  2. [2]Documenting Architecture Decisions · Michael Nygard, Cognitect, 2011
  3. [3]Bus-Faktor · Wikipedia
  4. [4]Bundesgesetz über den Datenschutz (DSG) · Fedlex, Schweizerische Eidgenossenschaft

Frequently asked questions.

How long does it take to understand an undocumented application?

How long it takes to understand an undocumented PHP application depends on its size and condition. You get the foundation, meaning inventory, risks, operations and immediate actions, with the Takeover Assessment from Unique-P within five business days of full access. The detailed knowledge then grows with every task and is documented as it goes.

Takeover Assessment

Do we need the previous developer for this?

You don’t need the previous developer to take over an undocumented application. A handover helps because it answers questions faster, but it isn’t a requirement. Code, version history, database and server configuration contain almost everything there is to know. Whatever is missing gets cleared up in a conversation with your people who work with the application every day.

When your developer can’t be reached

What is a characterization test?

A characterization test is a test that records how an application actually behaves today, rather than how it should behave. The term comes from Michael Feathers. Such tests are the safety line for changes to code that nobody fully understands, because they make every unintended change in behavior visible immediately.

What documentation is the minimum?

The minimum documentation for an application after a takeover is instructions for running the application locally and on the server, an operations manual covering deployment, backups and cron jobs, an overview of the interfaces and a short description of the architecture. All of it in the repository, so it stays current with the code.