How do I set up Prerender.io with Zend Framework 2 (PHP)?
Connect your Zend Framework 2 application to Prerender.io so AI crawlers and search engines receive fully rendered HTML instead of a JavaScript shell.
TL;DR
ZfrPrerender is a community-maintained Zend Framework 2 module that routes AI crawler and search engine requests through Prerender.io, returning fully rendered HTML. Install it via Composer, add your Prerender.io token to the module config, and your ZF2 application will serve clean, indexable pages to GPTBot, ClaudeBot, Googlebot, and other crawlers. Setup takes around 15 minutes.
ℹ️ Zend Framework 2 is now Laminas. Zend Framework 2 was transferred to the Linux Foundation and rebranded as the Laminas Project in 2019. ZfrPrerender was built for ZF2 and may not be compatible with Laminas without modification. If you are on Laminas, verify compatibility before proceeding or contact support@prerender.io to explore alternatives.
⚠️ This is a community-maintained integration, not an officially supported Prerender.io integration. The module is developed and maintained on GitHub. Prerender.io provides this guide as a reference only.
Not sure if this integration fits your stack? Ask Nexus, your AI integration assistant inside your Prerender.io dashboard. Describe your setup and Nexus will confirm the right path and walk you through it.
Step 1: Create a Prerender.io account.
Go to Prerender.io and sign up for an account, or sign in if you already have one.
Step 2: Copy your Prerender.io token.
Open your Prerender.io dashboard and navigate to Security > Token. Copy your token. You will add it to your ZF2 module configuration in a later step.
Step 3: Install ZfrPrerender via Composer.
In your Zend Framework 2 project root, run:
bash
composer require zf-fr/zfr-prerender
This installs the ZfrPrerender module and its dependencies. Full installation notes are in the README on GitHub.
Step 4: Enable the ZfrPrerender module in your application.
Open your config/application.config.php file and add ZfrPrerender to the modules array:
php
'modules' => [ // your existing modules 'ZfrPrerender', ],
Step 5: Add your Prerender.io token to the module configuration.
Create a local config file in your config/autoload/ directory (for example, prerender.local.php) and add:
php
return [ 'zfr_prerender' => [ 'prerender_token' => 'YOUR_PRERENDER_TOKEN', ], ];
Replace YOUR_PRERENDER_TOKEN with the token you copied in Step 2.
ℹ️ Confirm the exact config key names (zfr_prerender, prerender_token) against the ZfrPrerender README before deploying. If the keys are incorrect, the integration will silently fail to intercept crawler requests.
⚠️ Do not commit your Prerender.io token to version control. Use a .local.php config file (excluded from your .gitignore) or an environment variable to keep it out of your repository.
Refer to the ZfrPrerender README for the full list of available configuration options, including whitelisted and blacklisted URL patterns.
Step 6: Verify your integration is working.
Before going further, confirm that Prerender.io is correctly intercepting crawler requests and serving rendered HTML.
➡️ See Verify your integration for step-by-step instructions.
You can also run a quick check from your terminal using curl with a crawler user agent:
bash
curl -A googlebot https://www.yoursite.com/
Look for Prerender.io response headers in the output. If they are present, the integration is working.
✅ Your integration is working when Prerender.io shows cached pages appearing in your dashboard within 2 to 5 minutes of your first crawler request.
If you do not see Prerender.io headers, check that the module is registered correctly and that your token matches what is in your dashboard. If you see a "Prerender Integration Not Detected" error, see What should I do if I receive a Prerender integration not detected error?
Related Articles
- Available integrations
- How do I verify my Prerender.io integration is working?
- What should I do if I receive a Prerender integration not detected error?
- How Prerender.io works
💬 Still need help? If you have questions about setting up Prerender.io with Zend Framework 2, our support team can help. → Contact us at support@prerender.io