PHP / Laravel Integration
Server-sidePHP 7.4+Laravel 8+
Server-side integration for PHP and Laravel applications.
Prerequisites
PHP 7.4 or higher
Web server (Apache, Nginx, etc.)
Access to server files and configuration
A Suggesto account with at least one feedback board
Installation & Setup
1. Environment Configuration
Set up your environment variables for secure configuration management:
.env Configuration
2. Basic PHP Integration
Add the widget script to your PHP templates or layout files:
PHP Template Integration
Laravel Integration
Laravel Blade Template
Laravel Configuration
config/suggesto.php
Add your Board ID to the .env file:
.env
Symfony Integration
Twig Template Integration
Add the widget to your Symfony Twig templates:
templates/base.html.twig
Symfony Service
Create a service to manage Suggesto configuration:
src/Service/SuggestoService.php
Conditional Rendering
Load the widget conditionally based on user authentication, page context, or other PHP logic:
Conditional Widget Loading
Troubleshooting
Widget not loading?
Check these common issues:
- Verify the board ID is correctly set in environment variables
- Check server error logs for PHP errors
- Ensure the script tag is placed before closing </body> tag
- Verify HTTPS is enabled if serving over SSL
Content Security Policy (CSP) issues
If your site uses CSP headers, you may need to add:
Environment variable issues
If environment variables aren't loading:
- Ensure .env file is in the correct directory
- Check file permissions on .env file
- Verify your framework is loading environment variables
- Consider using getenv() instead of $_ENV
Performance considerations
For better performance:
- Cache the board ID value instead of reading from file repeatedly
- Use async/defer attributes on script tags
- Consider loading the widget only on specific pages
- Implement proper error handling for failed API calls
Finding Your Board ID
Replace
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
with your actual Board ID from the dashboard