PHP Script to Dynamically Customize Social Media SVG Templates Using JSON

Job ID: 39409227

Budget: €8 – €30 EUR

I'm building an automated SaaS platform that generates customized images for social media using editable SVG templates. I need a pure PHP script (no frameworks) that reads data from a JSON file and uses it to dynamically update a base SVG template.

The freelancer must also provide at least 20 custom SVG templates designed for social media use cases (e.g. Instagram posts, stories, LinkedIn banners, etc.).

I need a developer to build a script in pure PHP that performs the following:

1. Accept a JSON input with the following structure:
{
"primaryText": "Main headline",
"secondaryText": "Subheadline or description",
"colors": {
"color1": "#FF0000",
"color2": "#00FF00",
"color3": "#0000FF",
"color4": "#F1C40F"
},
"logo": "path/to/logo.png"
}

2. Modify an SVG template by:
- Replacing text fields (primaryText, secondaryText) using element id or class selectors inside the SVG.
- Replacing color fields (color1 to color4) by targeting SVG shapes with matching IDs or classes.
- Inserting or replacing a logo image using <image> and the provided logo path.
- Saving the result as a new, updated SVG file.

3 Work with any compatible SVG template.

Technical Requirements
- Script must be built in pure PHP (no frameworks like Laravel, Symfony, etc.).
- Use of native PHP XML tools (DOMDocument or SimpleXML) to parse and modify the SVG.
- Clean, well-documented code.
- JSON can be loaded from a file or string.
- Script should be runnable via the command line or through a browser.
Related categories: PHP Graphic Design SVG