PHP developer in Copenhagen

WordPress for businesses in Copenhagen, delivered remotely by one developer.

PHP developer

My place in the WordPress community

  • I have had a wordpress.org account since 2006.
  • I contributed to WordPress core for versions 7.0 and 7.1.
  • I maintain 30 plugins on wordpress.org.
  • I organise and speak at WordCamps.
  • I have attended every WordCamp Europe from 2017 to 2026.
  • Local WordPress meetup: WordPress Copenhagen

My WordPress.org profile

A PHP project that holds personal data usually has three copies of it: production, a staging site and a backup. Datatilsynet’s guidance on security of processing, in Danish “behandlingssikkerhed”, speaks to what happens in each. I am Mariusz Szatkowski, a developer in Gdynia on the same time zone as Copenhagen. I work remotely and in writing, and I have worked with WordPress since 2006. This page applies two Datatilsynet pages to PHP work: the one on test data and the one on deletion. The guidance is addressed to controllers, so the legal decisions stay with you and your data protection adviser. I am not a lawyer.

Rundetaarn, Copenhagen

Rundetaarn in Copenhagen. Photo: Dietmar Rabich, CC BY-SA 4.0, Wikimedia Commons, shown here as a Copenhagen landmark.

#May I test with real customer data?

Datatilsynet’s page on test data says it can be justified and necessary to use personal data when developing and testing IT systems. Its examples: final tests of integrations between systems, and cases where it is very hard to create realistic anonymised test data, because otherwise it can be difficult to find all errors that occur in production. Earlier in development, a limited number of personal data may be justified for troubleshooting, but under strict rules on access rights and with clean-up afterwards. The closer a system gets to production, the more justified more production data can be. The page even says it can express a lack of security to put a system into production without having tested with production data first.

The page names four things to keep in view when production data is used for testing:

  1. A legal basis in the GDPR and the Danish Data Protection Act. If testing is necessary for the original processing, such as handling orders in an order system, the basis is typically the same. If it is not necessary, the page says use for testing is mostly incompatible with the original purpose, and then the data cannot be used.
  2. Data minimisation. No more data than the test needs.
  3. Deletion after the test, under the storage limitation principle.
  4. Appropriate technical and organisational security measures.

The page adds that data from production does not get a lower level of protection because it is used for testing. It is still processing of personal data.

For a PHP project this is a policy question before it is a technical one. If the answer to “may we copy the live database to staging?” is yes, it should be a yes with a stated reason, a defined data scope and a deletion date, written down by the controller. The default I would propose is the other way round: staging starts with fictional or pseudonymised data, and real data enters only for a defined test.

#What security does a staging site need?

The guidance says that, as a starting point, the test environment should have the same security measures as are appropriate in the later production environment. It names access control, logging, secure transfer of data between IT environments and security updates of software and servers (patching). It also says it makes a difference which network the test environment is accessible from, and whether it can be reached from the internet.

That sentence describes a lot of real staging sites. A staging copy with a basic password on a public hostname, no logging, an old PHP version and a database dump from last week is the opposite of it. A checklist that follows from the page:

  • Access limited to named people, with accounts that can be removed, not one shared password.
  • Logging of access and of changes, as in production.
  • Transfer of the database over an encrypted connection, and no dumps in email, chat or a personal laptop’s downloads folder.
  • The same patch routine for PHP, the web server and the CMS or framework as on the live site.
  • Reachable only from where it needs to be: an IP allowlist or a VPN where possible, and noindex plus authentication where not.

Datatilsynet also says pseudonymisation is particularly relevant in development and test environments, since knowledge of specific persons is often not decisive for the test. In practice a sanitising step runs between the dump and the import: names, emails and addresses replaced with consistent fake values, free-text fields emptied, and order and invoice data kept in shape.

<?php
// Replace identifying columns with stable fake values during import.
// $pdo is an existing PDO connection to the staging database.
$update = $pdo->prepare(
    'UPDATE customers SET name = :name, email = :email, phone = NULL WHERE id = :id'
);

foreach ($pdo->query('SELECT id FROM customers') as $row) {
    $update->execute([
        ':id'    => $row['id'],
        ':name'  => 'Customer ' . $row['id'],
        ':email' => 'customer' . $row['id'] . '@example.invalid',
    ]);
}

A script like this is the easy part. The work is knowing every place personal data sits: order notes, uploads, log tables, search indexes, cached pages and webhook payload tables. If a new table is added and the sanitiser does not know it, the staging copy quietly contains live data again. A test that fails when a staging database contains an email address outside the reserved test domain catches that.

The page has one more rule for a project that grows up in place. Where the test environment later becomes the production environment, all personal data that was used only for testing must be deleted before the switch.

#Is a soft delete a deletion?

Datatilsynet’s page on deletion defines the term. Deletion in an IT system is an action that makes the data no longer available. If the data can still be reached by the system administrator after deletion, it is not real deletion. If the data has been deleted through the operating system and is waiting on disk to be overwritten, it counts, because it is no longer reachable by reasonable means.

The page then describes the PHP habit directly. A system can be split into a database that holds everything and a user-facing part that shows and edits it. Some systems use a “soft delete”, where deletion in the user-facing part removes the link but not the personal data in the database. Datatilsynet’s words: this is not real deletion, since the data can still be reached through the database, outside the user-facing part.

Soft delete flags are a normal pattern in PHP applications and ORMs. They have good uses, such as undoing a mistake. They do not satisfy a deletion duty. The usual compromise is a two-step design: the flag hides the record immediately, and a scheduled job removes the row and its dependent data for good after a set period. The period is a decision for the controller, taken per processing and documented.

#How do I build deletion into the schema?

Datatilsynet gives a design tip with a webshop example. When the controller lays out processing with deletion periods in mind, each period can be tied to a part of the system. In the example, invoices are kept for one period, and the customer’s other data sits in the profile so that it can be deleted together when its period ends. The point is not the figures in that example. It is that a system where each retention period maps to one place is easy to clean, and a system where invoice data, profile data and notes are tangled together is not.

For a PHP application this suggests a few rules:

  • Put data with different retention periods in different tables, not in one wide table.
  • Store the date from which deletion is due next to the record, so a job can find it with a simple query.
  • Keep foreign keys and cascades in mind. A deleted customer must not leave orphaned notes, files or search entries.
  • Treat uploaded files, caches and search indexes as part of the data to delete. They are not covered by a DELETE statement.

The page also asks for a deletion procedure that runs from the moment data reaches its deadline until deletion is carried out and confirmed. It names organisational points, such as who is responsible for starting the deletion and how completion is documented, and technical points, such as whether deletion is automatic or manual and which fields are affected, including the option of anonymising only the identifying fields.

It also says not to trust blindly that deletion runs work. A follow-up procedure can include reviewing technical logs from deletion runs and automated extracts of data that should have been deleted according to the deadline, for manual review.

<?php
// Nightly job: list rows that are past their deletion date, delete, then verify.
// $pdo is an existing PDO connection.
$due = $pdo->query(
    'SELECT id FROM customer_profiles WHERE delete_after < CURRENT_DATE'
)->fetchAll(PDO::FETCH_COLUMN);

$delete = $pdo->prepare('DELETE FROM customer_profiles WHERE id = :id');
$log    = $pdo->prepare(
    'INSERT INTO deletion_log (table_name, row_id, deleted_at) VALUES (:t, :id, NOW())'
);

foreach ($due as $id) {
    $delete->execute([':id' => $id]);
    $log->execute([':t' => 'customer_profiles', ':id' => $id]);
}

// Follow-up: this count should be zero on the next run.
$left = (int) $pdo->query(
    'SELECT COUNT(*) FROM customer_profiles WHERE delete_after < CURRENT_DATE'
)->fetchColumn();

The log records the table and row number, not the person. That matches the next point.

#What about logs and backups?

Datatilsynet notes that many systems log the actions performed, including deletions, and that those logs can themselves contain personal data, so deletion periods are needed for the logs too. For a PHP project that includes web server access logs, application error logs, queue tables and anything that writes request bodies. A framework debug mode that prints form input into a log file is a deletion problem as well as a security one.

On backups the page is specific. Since a backup exists to restore data, there will be situations where data deleted from the live system still sits in a backup. The controller should deal with that. Datatilsynet’s view is that personal data should be deleted from backups if technically possible, for example where a backup is an uncompressed copy of a database in which deletion can be done in the same way as in the live system. If it is not technically possible to delete single items from a backup, the controller must make sure that data deleted from the live system is removed again if the backup is restored. This may require a log of deletions made in the live system relative to the time a backup was created. Following data minimisation, the page says such a log should not hold directly identifying data, but can state, for example, that a given row in a table was deleted at a given time. The code above does exactly that.

A restore procedure for a PHP application should therefore include a step: after restoring, replay the deletion log from the backup date. A restore test that includes that step is worth more than a restore test that only checks that the site loads.

Datatilsynet also notes that a request under the right to be forgotten can oblige the controller to delete before the planned period ends. There is no duty to document such requests, but some controllers choose, under the accountability principle, to keep a log of them with the outcome and the date of deletion, and that log needs a reasonable deletion period of its own.

#What stays with the controller?

Everything legal. The page tells controllers to find the legal basis for processing, to set deletion periods per purpose, to document them and to take account of legal requirements that affect them. A developer cannot decide those. I can ask the questions in the right order and build what the answers require: a sanitising step, a retention date column, a deletion job, a deletion log and a restore procedure. Where the risk to data subjects is assessed as high, the test data page says a data protection impact assessment must be carried out. Whether that applies to your system is for you and your adviser.

#How does a project run?

  1. You send the application, the hosting, the environments that exist today and what personal data they hold. Expect my reply by email the next working day at the latest.
  2. I write down the scope and my assumptions, with questions on retention periods, who may have access to staging and how restores are tested.
  3. I build on a staging copy that holds sanitised data. Real data comes in only for a test your controller has approved in writing.
  4. I deploy to the live site after you confirm in writing. At handover you get the repository, the sanitising script, the deletion job and a short runbook.

Other PHP work I take on is listed on the PHP developer page.

#Cleaning up a PHP project in Copenhagen?

If your Copenhagen team has a staging copy of live data, a soft delete that never becomes a real one, or a backup routine nobody has tested against deletions, send the application, the hosting and the environments through the contact form. There is no charge for the first written estimate on that cleanup. Retention periods and the legal basis for test data are for your controller and adviser to settle.

See also in Denmark

Need this service: PHP developer in Copenhagen?

Describe your project by e-mail. I reply within 24 hours.

Describe your project

Latest PHP developer articles

Dec 2, 2026

Laravel Rust: what does it mean for PHP apps?

On 1 December 2026 Taylor Otwell shipped the Laravel Rust beta, and Laravel Go followed a day later. What the framework contains, what the 18x benchmark really measures, what happens to Laravel PHP and WordPress, and when a rewrite makes sense.

Explore other WordPress services and knowledge base