Generate product mockups with PHP
Generate product mockups with PHP using Guzzle and a single POST. Send your PSD template id and a design URL to the SudoMock render endpoint and get back a finished image URL. Start with 500 one-time renders, then choose a published monthly volume plan.
Your PSD renders with its Smart Objects, blend modes, smart filters, and perspective warp intact, plus editable text layers. It drops into Laravel, WordPress, or plain PHP, so a WooCommerce or custom store can produce on-product images at scale.
Install the Guzzle HTTP client
Grab an API key from your dashboard, then keep it in an environment variable. Every request authenticates with the x-api-key header.
1composer require guzzlehttp/guzzle2# Then set the key in your environment3export SUDOMOCK_API_KEY="sm_your_api_key"
Render your first mockup
One POST to the render endpoint composites your design into the PSD template and returns a finished image URL. Smart Objects, blend modes, smart filters, and perspective warp all render from your real file, so the output matches the template you built.
1<?php2require 'vendor/autoload.php';34$client = new \GuzzleHttp\Client();56$response = $client->post('https://api.sudomock.com/api/v1/renders', [7 'headers' => [8 'x-api-key' => getenv('SUDOMOCK_API_KEY'),9 'Content-Type' => 'application/json',10 ],11 'json' => [12 'mockup_uuid' => 'c315f78f-d2c7-4541-b240-a9372842de94',13 'smart_objects' => [[14 'uuid' => '128394ee-6758-4f2f-aa36-e2b19b152bd9',15 'asset' => ['url' => 'https://your-domain.com/design.png', 'fit' => 'cover'],16 ]],17 'export_options' => ['image_format' => 'webp', 'image_size' => 1920, 'quality' => 90],18 ],19]);2021$data = json_decode($response->getBody(), true);22echo 'Mockup ready: ' . $data['data']['print_files'][0]['export_path'];
How it works
- 1Upload a PSD once to get its mockup id and the ids of its Smart Objects and text layers.
- 2Send one render request per design with Guzzle from your PHP backend or WordPress hook.
- 3Read data.print_files[0].export_path from the decoded JSON and store the finished image URL.
Personalize text layers from PHP
SudoMock renders the text layers in your PSD, so you can swap the wording, font, size, and color at render time and get back an image that keeps the look the designer built.
- 2,000+ open-licensed font families, free for commercial use
- Custom TTF and OTF font upload, up to 5 MB each, on Pro and Scale
- Styled segments: mixed-style layers stay editable run by run
- Box text: area text wraps inside its box and clips exactly as designed
1<?php2// Swap the wording, font, size, and color on a named text layer.3$response = $client->post('https://api.sudomock.com/api/v1/renders', [4 'headers' => [5 'x-api-key' => getenv('SUDOMOCK_API_KEY'),6 'Content-Type' => 'application/json',7 ],8 'json' => [9 'mockup_uuid' => 'c315f78f-d2c7-4541-b240-a9372842de94',10 'text_layers' => [[11 'uuid' => 'b7f2c1a0-9e34-4d21-8f0a-1c2b3d4e5f60',12 'text' => 'SUMMER SALE',13 'font' => 'Poppins-Bold',14 'font_size' => 96,15 'color' => '#C0392B',16 ]],17 ],18]);1920$data = json_decode($response->getBody(), true);21echo $data['data']['print_files'][0]['export_path'];
Edit one mixed-style layer, run by run
When a single layer mixes styles, like a thin first name next to a bold surname, send a segments array with only the runs you want to change. Every run keeps its own font, size, and color, and any run you leave out stays as designed. This bundle of catalog, custom upload, per-segment styling, and box wrap over the API is what sets the text layers apart.
1{2 "mockup_uuid": "c315f78f-d2c7-4541-b240-a9372842de94",3 "text_layers": [4 {5 "uuid": "b7f2c1a0-9e34-4d21-8f0a-1c2b3d4e5f60",6 "segments": [7 { "index": 0, "text": "Jane " },8 { "index": 1, "text": "SMITH" }9 ]10 }11 ]12}
Full field reference and the fallback behavior when a font is not in your catalog live in the text layers documentation.
Frequently asked questions
How do I generate a product mockup in PHP?
Install Guzzle, then POST your PSD template id and a design URL to https://api.sudomock.com/api/v1/renders with your API key in the x-api-key header. Decode the JSON response and read data.print_files[0].export_path for the finished mockup image URL.
Does this work with Laravel and WordPress?
Yes. The endpoint is plain REST, so it works from Laravel with the Http client or Guzzle, from a WordPress or WooCommerce hook with wp_remote_post, and from any framework-free PHP script. Keep the API key in your server environment.
Can I edit text and fonts from PHP?
Yes. Add a text_layers array to the render body to change wording, font, size, and color on named layers. The catalog includes 2,000+ open-licensed font families, and mixed-style layers stay editable segment by segment.
Render your first PHP mockup in minutes
Get 500 one-time API credits to test. No credit card required. See pricing for published monthly volumes and annual billing.