Delete locked fields, programmatically
Purging is the second step, after the field was deleted. field.module should do that automatically for you.

A field config is an entity, you delete it like any other entity:

$field-&gt;delete();