The chemical reactions and pathways involving any member of a large group of derivatives or analogs of porphyrin. Porphyrins consists of a ring of four pyrrole nuclei linked each to the next at their alpha positions through a methine group.