When your PHP developer or agency leaves: what to do now and what next
When a developer or agency leaves, secure access first: you must be in control of the code, server, database, domain, hosting and all passwords and keys. Then ask for a proper handover, have a new developer assess the code, and decide on a rewrite only once you have the audit results in hand.
The first days: secure access
Whether the collaboration ended on good terms or in a dispute, the same rule applies: the application is yours, and you must hold the access to it, not the supplier. Until you do, nobody else can safely work on the project – and in the worse case you cannot be sure that someone who should no longer have access cannot reach production.
Go through the following areas one by one and for each of them check that you have your own access under a company e-mail address, not a shared account belonging to the supplier:
- Source code – the git repository (GitLab, GitHub, Bitbucket or your own server). Ideally the repository belongs to a company account and developers are only invited to it.
- Server or hosting – the hosting control panel, SSH or FTP access, management of the cloud account.
- Database – the access credentials and, above all, a current backup that you keep yourself.
- Domain and DNS – check with the registrar who is listed as the domain holder. If it is the supplier or one of their employees, arrange a transfer as soon as possible.
- E-mail and message sending – the SMTP service, SPF and DKIM settings, the accounts the application sends e-mails from.
- External services – payment gateway, carriers, accounting system, SMS gateway, maps, analytics, cloud storage. For each one, find out whose account it is registered to.
- Passwords, API keys and certificates – configuration files, the password manager, access to the application's administration.
Once you have access, change the passwords and keys the departing supplier had access to – including payment gateway API keys and database passwords. Do it carefully and with someone who knows everywhere the keys are used in the application, so that the change does not cause an outage.
Backup and monitoring before the first change
Before anyone touches the application, make a complete backup of the code, the database and uploaded files (images, documents, invoices) and store it outside the production server. Also check that backups will keep being made regularly – when a supplier leaves, it sometimes turns out that they were handled by the supplier's own script on the supplier's own server.
Set up at least simple uptime monitoring for the website and check where error messages and domain and SSL certificate expiry notices are sent. If they went to the departing developer's e-mail, redirect them to a company address. An outage you hear about from customers is the worst thing that can happen during the transition period.
What to ask for at handover
If the previous developer is willing to cooperate, even a short handover meeting saves the new developer hours of investigation. Ask for:
- the complete source code including all branches and the git history, not just an archive of files,
- confirmation of whether the code in the repository matches what actually runs in production,
- a description of deployment – how changes get to the server and what is run manually,
- a list of cron jobs and background processes,
- a list of integrations with external systems and where their credentials are stored,
- known bugs, unfinished changes and places that are “better left alone”,
- existing documentation, tests and instructions for setting up a local environment.
Also check in the contract what rights to the code you have – whether you hold a licence to modify it further, possibly an exclusive one. In disputed situations it is wise to consult a lawyer before the collaboration ends for good.
If the previous supplier does not cooperate, do not panic. The most complete source of the code is often the production server itself, and as the hosting provider's customer you can usually arrange access to it through them.
How a new developer assesses the state of the application
Before a new developer starts making changes, they should know what they are taking over. When I take over a project, I proceed roughly like this:
- Getting it running locally – if the application cannot be run outside production, that is the first finding and the first task.
- Versions and dependencies – PHP and framework versions, Composer libraries,
composer auditfor known vulnerabilities. An application on PHP 7.x or 8.0 no longer receives security fixes. - Static analysis – PHPStan quickly shows how consistent the code is and where the obvious bugs are.
- Security – SQL injection, XSS, protection of the administration, passwords and keys stored directly in the code or in git.
- Architecture – where the business logic lives, how tightly coupled the code is, whether there are tests.
- Operations – backups, error logging, the deployment method, test environments.
The result should be a written report that company management can understand too: what is critical and must be fixed immediately, what to plan and what can wait – with an effort estimate. Without it, decisions about further development are made on gut feeling.
Rewrite from scratch, or fix it gradually?
After a first look at old code, a new developer often proposes rewriting the whole application. Sometimes that is right; usually it is not. An existing application carries years of business logic and handled edge cases that nobody has written down – and which have to be rediscovered during a rewrite, often only after launch.
Gradual refactoring makes sense when:
- the application works and the business earns money with it,
- the problems are concentrated in certain parts,
- the code can be gradually moved to a supported version of PHP and the framework,
- you cannot afford months in which a new system is being developed while the old one stands still.
Replacement or a rewrite is worth considering when:
- the application is built on technology that can no longer reasonably be run or updated,
- the business has changed so much since it was built that most features no longer match its needs,
- there is an off-the-shelf product that covers the needs better,
- an audit shows that fixing it would cost more than a new solution.
A common sensible compromise is gradual replacement: the application keeps running and individual parts are rewritten or split off one after another. The risk is spread across smaller steps, each of which can be rolled back.
How to avoid depending on a single supplier next time
A developer leaving should not be a crisis. You can prepare for it while the collaboration is still going:
- The company owns the accounts. The repository, hosting, domain and external services are registered to the company; the supplier only has assigned access.
- Passwords in a company password manager, not in one person's head or e-mail.
- Standard technologies. A widely used framework such as Nette or Symfony means you will find another developer. A single author's custom framework is a risk.
- Code in git and repeatable deployment, ideally automated in CI, for example in GitLab CI.
- Tests and static analysis for key processes – they make the work easier for every future developer.
- Short documentation: how to run and deploy the application and where the important settings are. One page in the repository is enough.
- A clear contract covering rights to the code and the obligation to cooperate at handover.
Checklist: when a PHP developer leaves
- Your own access to the repository with the complete history
- Your own access to the hosting or server
- Database access and a current backup stored outside the server
- Domain registered to the company, access to the registrar and DNS
- List of external services and accounts, all registered to the company
- Passwords, API keys and access changed after the supplier's departure
- Description of deployment, cron jobs and integrations with other systems
- Rights to the source code verified in the contract
- Application running outside production
- Written assessment of the code with priorities and an effort estimate
- Decision on next steps based on the audit, not on gut feeling
How I can help
I regularly take over projects from other developers and agencies – in Nette, Symfony and old PHP without a framework. I start with a PHP application audit, which for a takeover typically takes 4–8 h (10,000–20,000 CZK excl. VAT) and gives you an overview of what you have and what needs to be dealt with first.
I describe how the whole PHP project takeover works – from securing access to stabilisation and further development – on a separate page. And if the audit shows that it makes more sense to replace part of the application, we can talk about custom development.