Legal Generator
A PHP-based tool for creating GDPR-compliant documents and legal notices in PDF format.
Descriptions
Overview
PHP GDPR & Legal Notices PDF Generator is a powerful script that creates customized legal texts for your website, instantly exportable to PDF using DomPDF. Perfect for web agencies, freelancers, and website owners who need fast, compliant, and multilingual legal pages.
Why This Script?
Creating legal notices and GDPR texts manually takes time and requires legal knowledge. With this script, you simply fill out a responsive form, and the system generates fully formatted, compliant documents in PDF format — ready to publish on your website.
Features
- Multilingual Support: Includes English, French, and Spanish with easy extensibility to other languages
- Instant PDF Export: Professional PDF generation with DomPDF integration
- Security First:
- CSRF protection
- Secure HTTP headers (CSP, HSTS, X-Frame-Options, etc.)
- Input sanitization to prevent XSS attacks
- Session management with configurable timeout
- Responsive Interface: Works seamlessly on desktop and mobile devices
- Complete Form Fields: Company name, SIRET, address, email, phone, hosting provider, business activity, and customizable GDPR options
- Easy Installation: Just upload, configure, and use
- Well-Organized Project Structure: Maintainable and scalable code architecture
- Unit Tests Included: Verify validity of emails, phone numbers, and SIRET numbers
- Customizable Translations: Edit or extend easily via language files
- PDF Templates: Separate CSS for styling PDF outputs
- Lightweight and Secure: Minimal dependencies with security-first design
Project Structure
- /lang/ – Translations (FR, EN, ES)
- /lib/dompdf/ – PDF generation library
- /public/ – Frontend files (CSS, JS, form pages)
- /src/ – Core PHP classes: Security, Session, Translation, PDF Generation, Validation
- /views/ – HTML templates
- composer.json – Dependency management
- index.php – Main form
- generate.php – PDF generation controller
Perfect For
- Web agencies needing fast, reusable legal page generation
- Freelancers offering GDPR compliance as a service
- Entrepreneurs creating websites without coding skills
- Any PHP website needing multilingual legal pages
Requirements
- PHP Version: 7.4 or higher (compatible with PHP 8+)
- Composer: Required for dependency management (especially DomPDF)
- PHP Extensions: mbstring enabled, plus standard PHP extensions required by DomPDF
- Web Server: Apache or Nginx configured to run PHP
- Browser: Modern browser for responsive interface (desktop or mobile)
Instructions
Download & Extract
Download the ZIP file and extract the contents into your website directory.
Install Dependencies
Make sure Composer is installed. Open a terminal in your project folder and run:
composer installConfigure PHP Environment
Ensure your server runs PHP 7.4+ or PHP 8+. Make sure mbstring and required PHP extensions are enabled.
Customize Language & Settings
Edit the language files (
/lang/fr.php, /lang/en.php, /lang/es.php) to customize text. Adjust session settings in /src/Session/SessionManager.php if needed.Access the Form
Open
index.php in your browser. Fill out your company info, SIRET, address, contact details, and GDPR options.Generate Legal Documents
Click the "Generate PDF" button. The system creates a ready-to-use PDF with your legal notices and GDPR text.
Use on Your Website
Upload the generated PDF to your server or provide it to users directly.
Optional: Run Tests
To validate emails, phone numbers, and SIRET numbers:
php src/tests/ValidatorManagerTest.phpHex Information (For Shop Owner): 57734

Add a review