feat(pdf): add DomPDF integration and ebook download feature

Integrate barryvdh/laravel-dompdf package for PDF generation with
custom configuration. Add authenticated ebook download route and view.
Update footer to display ebook download link for logged-in users.
This commit is contained in:
2026-10-07 22:28:01 -03:00
parent d1e8abe428
commit ab6df785c4
10 changed files with 1039 additions and 4 deletions
Binary file not shown.
Binary file not shown.
+1
View File
@@ -5,4 +5,5 @@ use App\Providers\AppServiceProvider;
return [ return [
App\Providers\AppServiceProvider::class, App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class, App\Providers\AuthServiceProvider::class,
Barryvdh\DomPDF\ServiceProvider::class,
]; ];
+2 -2
View File
@@ -7,9 +7,9 @@
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^8.3", "php": "^8.3",
"barryvdh/laravel-dompdf": "^3.1",
"laravel/framework": "^13.8", "laravel/framework": "^13.8",
"laravel/tinker": "^3.0", "laravel/tinker": "^3.0"
"barryvdh/laravel-dompdf": "^3.0"
}, },
"require-dev": { "require-dev": {
"fakerphp/faker": "^1.23", "fakerphp/faker": "^1.23",
Generated
+378 -1
View File
@@ -4,8 +4,85 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "16e72b11427154de902612c561b9c304", "content-hash": "2a63f5b976767b68f7e581743095bd53",
"packages": [ "packages": [
{
"name": "barryvdh/laravel-dompdf",
"version": "v3.1.2",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-dompdf.git",
"reference": "ee3b72b19ccdf57d0243116ecb2b90261344dedc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/ee3b72b19ccdf57d0243116ecb2b90261344dedc",
"reference": "ee3b72b19ccdf57d0243116ecb2b90261344dedc",
"shasum": ""
},
"require": {
"dompdf/dompdf": "^3.0",
"illuminate/support": "^9|^10|^11|^12|^13.0",
"php": "^8.1"
},
"require-dev": {
"larastan/larastan": "^2.7|^3.0",
"orchestra/testbench": "^7|^8|^9.16|^10|^11.0",
"phpro/grumphp": "^2.5",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"PDF": "Barryvdh\\DomPDF\\Facade\\Pdf",
"Pdf": "Barryvdh\\DomPDF\\Facade\\Pdf"
},
"providers": [
"Barryvdh\\DomPDF\\ServiceProvider"
]
},
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Barryvdh\\DomPDF\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "A DOMPDF Wrapper for Laravel",
"keywords": [
"dompdf",
"laravel",
"pdf"
],
"support": {
"issues": "https://github.com/barryvdh/laravel-dompdf/issues",
"source": "https://github.com/barryvdh/laravel-dompdf/tree/v3.1.2"
},
"funding": [
{
"url": "https://fruitcake.nl",
"type": "custom"
},
{
"url": "https://github.com/barryvdh",
"type": "github"
}
],
"time": "2026-02-21T08:51:10+00:00"
},
{ {
"name": "brick/math", "name": "brick/math",
"version": "0.18.0", "version": "0.18.0",
@@ -376,6 +453,161 @@
], ],
"time": "2024-02-05T11:56:58+00:00" "time": "2024-02-05T11:56:58+00:00"
}, },
{
"name": "dompdf/dompdf",
"version": "v3.1.6",
"source": {
"type": "git",
"url": "https://github.com/dompdf/dompdf.git",
"reference": "6d4b4eb8500f7a786da8868ba463a71b725a4005"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/6d4b4eb8500f7a786da8868ba463a71b725a4005",
"reference": "6d4b4eb8500f7a786da8868ba463a71b725a4005",
"shasum": ""
},
"require": {
"dompdf/php-font-lib": "^1.0.0",
"dompdf/php-svg-lib": "^1.0.0",
"ext-dom": "*",
"ext-mbstring": "*",
"masterminds/html5": "^2.0",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"ext-gd": "*",
"ext-json": "*",
"ext-zip": "*",
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11",
"squizlabs/php_codesniffer": "^3.5",
"symfony/process": "^4.4 || ^5.4 || ^6.2 || ^7.0"
},
"suggest": {
"ext-gd": "Needed to process images",
"ext-gmagick": "Improves image processing performance",
"ext-imagick": "Improves image processing performance",
"ext-zlib": "Needed for pdf stream compression"
},
"type": "library",
"autoload": {
"psr-4": {
"Dompdf\\": "src/"
},
"classmap": [
"lib/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "The Dompdf Community",
"homepage": "https://github.com/dompdf/dompdf/blob/master/AUTHORS.md"
}
],
"description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
"homepage": "https://github.com/dompdf/dompdf",
"support": {
"issues": "https://github.com/dompdf/dompdf/issues",
"source": "https://github.com/dompdf/dompdf/tree/v3.1.6"
},
"time": "2026-07-20T12:29:38+00:00"
},
{
"name": "dompdf/php-font-lib",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-font-lib.git",
"reference": "a6e9a688a2a80016ac080b97be73d3e10c444c9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/a6e9a688a2a80016ac080b97be73d3e10c444c9a",
"reference": "a6e9a688a2a80016ac080b97be73d3e10c444c9a",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11 || ^12"
},
"type": "library",
"autoload": {
"psr-4": {
"FontLib\\": "src/FontLib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "The FontLib Community",
"homepage": "https://github.com/dompdf/php-font-lib/blob/master/AUTHORS.md"
}
],
"description": "A library to read, parse, export and make subsets of different types of font files.",
"homepage": "https://github.com/dompdf/php-font-lib",
"support": {
"issues": "https://github.com/dompdf/php-font-lib/issues",
"source": "https://github.com/dompdf/php-font-lib/tree/1.0.2"
},
"time": "2026-01-20T14:10:26+00:00"
},
{
"name": "dompdf/php-svg-lib",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/dompdf/php-svg-lib.git",
"reference": "8259ffb930817e72b1ff1caef5d226501f3dfeb1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/8259ffb930817e72b1ff1caef5d226501f3dfeb1",
"reference": "8259ffb930817e72b1ff1caef5d226501f3dfeb1",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1 || ^8.0",
"sabberworm/php-css-parser": "^8.4 || ^9.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11"
},
"type": "library",
"autoload": {
"psr-4": {
"Svg\\": "src/Svg"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0-or-later"
],
"authors": [
{
"name": "The SvgLib Community",
"homepage": "https://github.com/dompdf/php-svg-lib/blob/master/AUTHORS.md"
}
],
"description": "A library to read, parse and export to PDF SVG files.",
"homepage": "https://github.com/dompdf/php-svg-lib",
"support": {
"issues": "https://github.com/dompdf/php-svg-lib/issues",
"source": "https://github.com/dompdf/php-svg-lib/tree/1.0.2"
},
"time": "2026-01-02T16:01:13+00:00"
},
{ {
"name": "dragonmantank/cron-expression", "name": "dragonmantank/cron-expression",
"version": "v3.6.0", "version": "v3.6.0",
@@ -2032,6 +2264,73 @@
], ],
"time": "2026-03-08T20:05:35+00:00" "time": "2026-03-08T20:05:35+00:00"
}, },
{
"name": "masterminds/html5",
"version": "2.11.0",
"source": {
"type": "git",
"url": "https://github.com/Masterminds/html5-php.git",
"reference": "a1e7a2f88ee13635d86fc61cfbdf2306a76ddfc7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Masterminds/html5-php/zipball/a1e7a2f88ee13635d86fc61cfbdf2306a76ddfc7",
"reference": "a1e7a2f88ee13635d86fc61cfbdf2306a76ddfc7",
"shasum": ""
},
"require": {
"ext-dom": "*",
"php": ">=7.4"
},
"require-dev": {
"phpunit/phpunit": "^6 || ^7 || ^8 || ^9 || ^10"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
}
},
"autoload": {
"psr-4": {
"Masterminds\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Matt Butcher",
"email": "technosophos@gmail.com"
},
{
"name": "Matt Farina",
"email": "matt@mattfarina.com"
},
{
"name": "Asmir Mustafic",
"email": "goetas@gmail.com"
}
],
"description": "An HTML5 parser and serializer.",
"homepage": "http://masterminds.github.io/html5-php",
"keywords": [
"HTML5",
"dom",
"html",
"parser",
"querypath",
"serializer",
"xml"
],
"support": {
"issues": "https://github.com/Masterminds/html5-php/issues",
"source": "https://github.com/Masterminds/html5-php/tree/2.11.0"
},
"time": "2026-08-18T06:18:41+00:00"
},
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
"version": "3.10.0", "version": "3.10.0",
@@ -3306,6 +3605,84 @@
}, },
"time": "2026-06-18T03:57:49+00:00" "time": "2026-06-18T03:57:49+00:00"
}, },
{
"name": "sabberworm/php-css-parser",
"version": "v9.5.0",
"source": {
"type": "git",
"url": "https://github.com/MyIntervals/PHP-CSS-Parser.git",
"reference": "f284e63b6e891e0c28631e54ba06c3ed102a9ef3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/f284e63b6e891e0c28631e54ba06c3ed102a9ef3",
"reference": "f284e63b6e891e0c28631e54ba06c3ed102a9ef3",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"php": "^7.2.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "1.4.0",
"phpstan/extension-installer": "1.4.3",
"phpstan/phpstan": "1.12.33 || 2.2.9",
"phpstan/phpstan-phpunit": "1.4.2 || 2.0.18",
"phpstan/phpstan-strict-rules": "1.6.2 || 2.0.12",
"phpunit/phpunit": "8.5.54",
"rawr/phpunit-data-provider": "3.3.1",
"rector/rector": "1.2.10 || 2.6.2",
"rector/type-perfect": "1.0.0 || 2.1.4",
"squizlabs/php_codesniffer": "4.0.4"
},
"suggest": {
"ext-mbstring": "for parsing UTF-8 CSS"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "9.6.x-dev"
}
},
"autoload": {
"files": [
"src/Rule/Rule.php",
"src/RuleSet/RuleContainer.php"
],
"psr-4": {
"Sabberworm\\CSS\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Raphael Schweikert"
},
{
"name": "Oliver Klee",
"email": "github@oliverklee.de"
},
{
"name": "Jake Hotson",
"email": "jake.github@qzdesign.co.uk"
}
],
"description": "Parser for CSS Files written in PHP",
"homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser",
"keywords": [
"css",
"parser",
"stylesheet"
],
"support": {
"issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues",
"source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v9.5.0"
},
"time": "2026-09-20T15:02:00+00:00"
},
{ {
"name": "symfony/clock", "name": "symfony/clock",
"version": "v7.4.8", "version": "v7.4.8",
+301
View File
@@ -0,0 +1,301 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Settings
|--------------------------------------------------------------------------
|
| Set some default values. It is possible to add all defines that can be set
| in dompdf_config.inc.php. You can also override the entire config file.
|
*/
'show_warnings' => false, // Throw an Exception on warnings from dompdf
'public_path' => null, // Override the public path if needed
/*
* Dejavu Sans font is missing glyphs for converted entities, turn it off if you need to show € and £.
*/
'convert_entities' => true,
'options' => [
/**
* The location of the DOMPDF font directory
*
* The location of the directory where DOMPDF will store fonts and font metrics
* Note: This directory must exist and be writable by the webserver process.
* *Please note the trailing slash.*
*
* Notes regarding fonts:
* Additional .afm font metrics can be added by executing load_font.php from command line.
*
* Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
* be embedded in the pdf file or the PDF may not display correctly. This can significantly
* increase file size unless font subsetting is enabled. Before embedding a font please
* review your rights under the font license.
*
* Any font specification in the source HTML is translated to the closest font available
* in the font directory.
*
* The pdf standard "Base 14 fonts" are:
* Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
* Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
* Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
* Symbol, ZapfDingbats.
*/
'font_dir' => storage_path('fonts'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
/**
* The location of the DOMPDF font cache directory
*
* This directory contains the cached font metrics for the fonts used by DOMPDF.
* This directory can be the same as DOMPDF_FONT_DIR
*
* Note: This directory must exist and be writable by the webserver process.
*/
'font_cache' => storage_path('fonts'),
/**
* The location of a temporary directory.
*
* The directory specified must be writeable by the webserver process.
* The temporary directory is required to download remote images and when
* using the PDFLib back end.
*/
'temp_dir' => sys_get_temp_dir(),
/**
* ==== IMPORTANT ====
*
* dompdf's "chroot": Prevents dompdf from accessing system files or other
* files on the webserver. All local files opened by dompdf must be in a
* subdirectory of this directory. DO NOT set it to '/' since this could
* allow an attacker to use dompdf to read any files on the server. This
* should be an absolute path.
* This is only checked on command line call by dompdf.php, but not by
* direct class use like:
* $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
*/
'chroot' => realpath(base_path()),
/**
* Protocol whitelist
*
* Protocols and PHP wrappers allowed in URIs, and the validation rules
* that determine if a resouce may be loaded. Full support is not guaranteed
* for the protocols/wrappers specified
* by this array.
*
* @var array
*/
'allowed_protocols' => [
'data://' => ['rules' => []],
'file://' => ['rules' => []],
'http://' => ['rules' => []],
'https://' => ['rules' => []],
],
/**
* Operational artifact (log files, temporary files) path validation
*/
'artifactPathValidation' => null,
/**
* @var string
*/
'log_output_file' => null,
/**
* Whether to enable font subsetting or not.
*/
'enable_font_subsetting' => false,
/**
* The PDF rendering backend to use
*
* Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
* 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will
* fall back on CPDF. 'GD' renders PDFs to graphic files.
* {@link * Canvas_Factory} ultimately determines which rendering class to
* instantiate based on this setting.
*
* Both PDFLib & CPDF rendering backends provide sufficient rendering
* capabilities for dompdf, however additional features (e.g. object,
* image and font support, etc.) differ between backends. Please see
* {@link PDFLib_Adapter} for more information on the PDFLib backend
* and {@link CPDF_Adapter} and lib/class.pdf.php for more information
* on CPDF. Also see the documentation for each backend at the links
* below.
*
* The GD rendering backend is a little different than PDFLib and
* CPDF. Several features of CPDF and PDFLib are not supported or do
* not make any sense when creating image files. For example,
* multiple pages are not supported, nor are PDF 'objects'. Have a
* look at {@link GD_Adapter} for more information. GD support is
* experimental, so use it at your own risk.
*
* @link http://www.pdflib.com
* @link http://www.ros.co.nz/pdf
* @link http://www.php.net/image
*/
'pdf_backend' => 'CPDF',
/**
* html target media view which should be rendered into pdf.
* List of types and parsing rules for future extensions:
* http://www.w3.org/TR/REC-html40/types.html
* screen, tty, tv, projection, handheld, print, braille, aural, all
* Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
* Note, even though the generated pdf file is intended for print output,
* the desired content might be different (e.g. screen or projection view of html file).
* Therefore allow specification of content here.
*/
'default_media_type' => 'screen',
/**
* The default paper size.
*
* North America standard is "letter"; other countries generally "a4"
*
* @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
*/
'default_paper_size' => 'a4',
/**
* The default paper orientation.
*
* The orientation of the page (portrait or landscape).
*
* @var string
*/
'default_paper_orientation' => 'portrait',
/**
* The default font family
*
* Used if no suitable fonts can be found. This must exist in the font folder.
*
* @var string
*/
'default_font' => 'serif',
/**
* Image DPI setting
*
* This setting determines the default DPI setting for images and fonts. The
* DPI may be overridden for inline images by explictly setting the
* image's width & height style attributes (i.e. if the image's native
* width is 600 pixels and you specify the image's width as 72 points,
* the image will have a DPI of 600 in the rendered PDF. The DPI of
* background images can not be overridden and is controlled entirely
* via this parameter.
*
* For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
* If a size in html is given as px (or without unit as image size),
* this tells the corresponding size in pt.
* This adjusts the relative sizes to be similar to the rendering of the
* html page in a reference browser.
*
* In pdf, always 1 pt = 1/72 inch
*
* Rendering resolution of various browsers in px per inch:
* Windows Firefox and Internet Explorer:
* SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
* Linux Firefox:
* about:config *resolution: Default:96
* (xorg screen dimension in mm and Desktop font dpi settings are ignored)
*
* Take care about extra font/image zoom factor of browser.
*
* In images, <img> size in pixel attribute, img css style, are overriding
* the real image dimension in px for rendering.
*
* @var int
*/
'dpi' => 96,
/**
* Enable embedded PHP
*
* If this setting is set to true then DOMPDF will automatically evaluate embedded PHP contained
* within <script type="text/php"> ... </script> tags.
*
* ==== IMPORTANT ==== Enabling this for documents you do not trust (e.g. arbitrary remote html pages)
* is a security risk.
* Embedded scripts are run with the same level of system access available to dompdf.
* Set this option to false (recommended) if you wish to process untrusted documents.
* This setting may increase the risk of system exploit.
* Do not change this settings without understanding the consequences.
* Additional documentation is available on the dompdf wiki at:
* https://github.com/dompdf/dompdf/wiki
*
* @var bool
*/
'enable_php' => false,
/**
* Enable inline JavaScript
*
* If this setting is set to true then DOMPDF will automatically insert JavaScript code contained
* within <script type="text/javascript"> ... </script> tags as written into the PDF.
* NOTE: This is PDF-based JavaScript to be executed by the PDF viewer,
* not browser-based JavaScript executed by Dompdf.
*
* @var bool
*/
'enable_javascript' => true,
/**
* Enable remote file access
*
* If this setting is set to true, DOMPDF will access remote sites for
* images and CSS files as required.
*
* ==== IMPORTANT ====
* This can be a security risk, in particular in combination with isPhpEnabled and
* allowing remote html code to be passed to $dompdf = new DOMPDF(); $dompdf->load_html(...);
* This allows anonymous users to download legally doubtful internet content which on
* tracing back appears to being downloaded by your server, or allows malicious php code
* in remote html pages to be executed by your server with your account privileges.
*
* This setting may increase the risk of system exploit. Do not change
* this settings without understanding the consequences. Additional
* documentation is available on the dompdf wiki at:
* https://github.com/dompdf/dompdf/wiki
*
* @var bool
*/
'enable_remote' => false,
/**
* List of allowed remote hosts
*
* Each value of the array must be a valid hostname.
*
* This will be used to filter which resources can be loaded in combination with
* isRemoteEnabled. If enable_remote is FALSE, then this will have no effect.
*
* Leave to NULL to allow any remote host.
*
* @var array|null
*/
'allowed_remote_hosts' => null,
/**
* A ratio applied to the fonts height to be more like browsers' line height
*/
'font_height_ratio' => 1.1,
/**
* Use the HTML5 Lib parser
*
* @deprecated This feature is now always on in dompdf 2.x
*
* @var bool
*/
'enable_html5_parser' => true,
],
];
Binary file not shown.
@@ -7,7 +7,10 @@
<div class="col-md-6 text-center text-md-end"> <div class="col-md-6 text-center text-md-end">
<a href="{{ route('legal.document.show', 'terms-of-service') }}" class="text-white text-decoration-none small me-3">@lang('footer.terms_of_service')</a> <a href="{{ route('legal.document.show', 'terms-of-service') }}" class="text-white text-decoration-none small me-3">@lang('footer.terms_of_service')</a>
<a href="{{ route('legal.document.show', 'privacy-policy') }}" class="text-white text-decoration-none small me-3">@lang('footer.privacy_policy')</a> <a href="{{ route('legal.document.show', 'privacy-policy') }}" class="text-white text-decoration-none small me-3">@lang('footer.privacy_policy')</a>
<a href="javascript:void(0)" onclick="cookieConsent.showPreferences()" class="text-white text-decoration-none small">@lang('footer.cookie_preferences')</a> <a href="javascript:void(0)" onclick="cookieConsent.showPreferences()" class="text-white text-decoration-none small me-3">@lang('footer.cookie_preferences')</a>
@auth
<a href="{{ route('ebook.download') }}" class="text-white text-decoration-none small"><i class="bi bi-file-pdf me-1"></i>Ebook</a>
@endauth
</div> </div>
</div> </div>
</div> </div>
+345
View File
@@ -0,0 +1,345 @@
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>GPrompt - Ebook para Desenvolvedores</title>
<style>
body { font-family: 'DejaVu Sans', sans-serif; color: #333; line-height: 1.6; font-size: 10pt; margin: 20px; }
h1 { font-size: 18pt; color: #4e73df; border-bottom: 2px solid #4e73df; padding-bottom: 5px; margin-top: 20px; }
h2 { font-size: 13pt; color: #2c3e50; margin-top: 15px; }
h3 { font-size: 11pt; color: #555; margin-top: 12px; }
p { margin-bottom: 8px; text-align: justify; }
ul, ol { margin-bottom: 8px; padding-left: 18px; }
li { margin-bottom: 3px; }
.cover { text-align: center; padding-top: 100px; }
.cover h1 { font-size: 28pt; border: none; }
.cover h2 { font-size: 14pt; color: #666; font-weight: normal; }
.cover p { font-size: 11pt; color: #888; text-align: center; }
.page-break { page-break-before: always; }
.box { border: 1px solid #4e73df; padding: 10px; margin: 10px 0; background: #f8f9fc; }
.box h3 { color: #4e73df; margin-top: 0; }
.alert { border: 1px solid #1cc88a; padding: 10px; margin: 10px 0; background: #f0fdf4; }
.alert h3 { color: #1cc88a; margin-top: 0; }
.warning { border: 1px solid #e74a3b; padding: 10px; margin: 10px 0; background: #fff5f5; }
.warning h3 { color: #e74a3b; margin-top: 0; }
table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 9pt; }
th { background: #4e73df; color: #fff; padding: 5px; text-align: left; }
td { padding: 5px; border-bottom: 1px solid #ddd; }
code { font-family: 'DejaVu Sans Mono', monospace; font-size: 8pt; background: #f4f4f4; padding: 1px 3px; }
pre { background: #f4f4f4; padding: 8px; font-size: 8pt; font-family: 'DejaVu Sans Mono', monospace; border-left: 3px solid #4e73df; }
.toc li { padding: 3px 0; }
.cover .badge { background: #4e73df; color: #fff; padding: 5px 15px; border-radius: 3px; font-size: 10pt; }
.footer { text-align: center; color: #999; font-size: 7pt; margin-top: 20px; padding-top: 10px; border-top: 1px solid #eee; }
</style>
</head>
<body>
<div class="cover">
<h1>GPrompt</h1>
<h2>Sistema de Geração de Prompts Inteligentes</h2>
<br>
<p><strong>Ebook para Desenvolvedores</strong></p>
<p>Crie sites, landing pages e aplicativos com a potência da IA</p>
<br><br>
<p>Versão 1.0 — Outubro 2026</p>
</div>
<div class="page-break"></div>
<h1>Sumário</h1>
<ul class="toc">
<li>1. O que é o GPrompt?</li>
<li>2. Conceitos Fundamentais</li>
<li>3. Primeiros Passos</li>
<li>4. Templates de Projeto</li>
<li>5. Arquivos Padrão (LGPD)</li>
<li>6. Requisitos de Sistema</li>
<li>7. Provedores de IA</li>
<li>8. Casos de Uso Práticos</li>
<li>9. Boas Práticas</li>
<li>10. Conclusão</li>
</ul>
<div class="page-break"></div>
<h1>1. O que é o GPrompt?</h1>
<p>O GPrompt é um sistema web completo para geração de prompts inteligentes destinados à criação de sites, landing pages, aplicativos e sistemas web. Ele foi projetado para desenvolvedores que desejam acelerar seu fluxo de trabalho utilizando Inteligência Artificial, mantendo total controle sobre o resultado final.</p>
<div class="alert">
<h3>Para quem este ebook foi feito</h3>
<p>Desenvolvedores front-end e full-stack, designers que codam, agências digitais, freelancers e qualquer profissional que crie sites, landing pages ou aplicativos web e queira usar IA para aumentar sua produtividade.</p>
</div>
<p>Diferente de ferramentas genéricas de IA, o GPrompt entende o contexto brasileiro: templates em português, conformidade com a LGPD (Lei Geral de Proteção de Dados), termos de uso e política de privacidade adequados à legislação brasileira, e geração automática de arquivos essenciais como LICENSE, README.md e RULES.md.</p>
<h2>Principais Diferenciais</h2>
<ul>
<li>36 templates prontos para diversos tipos de projeto (landing pages, sistemas SaaS, APIs, e-commerce, blogs, dashboards)</li>
<li>Múltiplos provedores de IA: OpenRouter, StepFun e Llama.cpp local</li>
<li>Arquivos padrão automáticos: LICENSE, README.md, RULES.md, banner de cookies LGPD, termos de uso e política de privacidade</li>
<li>Requisitos de sistema embutidos: design responsivo, SEO completo, dependências com licença MIT, toggle de senha</li>
<li>Geração multi-arquivo: o prompt gerado instrui a criação de projetos completos com estrutura de pastas organizada</li>
</ul>
<div class="page-break"></div>
<h1>2. Conceitos Fundamentais</h1>
<h2>2.1 O que é Prompt Engineering?</h2>
<p>Prompt Engineering é a arte e a ciência de criar instruções precisas para Inteligências Artificiais. Um prompt bem elaborado produz resultados muito superiores a um prompt genérico. O GPrompt automatiza exatamente este processo: ele pega suas especificações e constrói o prompt ideal para cada tipo de projeto.</p>
<h2>2.2 Como o GPrompt Funciona</h2>
<div class="box">
<h3>Fluxo de Trabalho</h3>
<ol>
<li>Crie um Projeto: Defina o objetivo, contexto, persona, tom, restrições e formato de saída</li>
<li>Escolha um Template: Selecione entre 36 templates pré-configurados ou crie o seu próprio</li>
<li>Selecione o Provedor/Modelo de IA: OpenRouter, StepFun ou Llama.cpp local</li>
<li>Gere o Prompt: O sistema monta um prompt otimizado com todas as especificações</li>
<li>Use o Prompt: Copie o prompt gerado e utilize no VSCode, Cursor, ou qualquer ferramenta de IA</li>
<li>Obtenha o Projeto Completo: A IA cria todos os arquivos do projeto</li>
</ol>
</div>
<h2>2.3 A Arquitetura do Sistema</h2>
<table>
<tr><th>Componente</th><th>Função</th></tr>
<tr><td>Projetos de Prompt</td><td>Onde você define as especificações do seu projeto</td></tr>
<tr><td>Templates</td><td>Modelos pré-configurados para iniciar rapidamente</td></tr>
<tr><td>Provedores IA</td><td>Configuração dos serviços de IA (OpenRouter, StepFun, Llama.cpp)</td></tr>
<tr><td>Serviço de Geração</td><td>Monta o prompt otimizado e se comunica com a IA</td></tr>
<tr><td>Arquivos Padrão</td><td>Gera automaticamente LICENSE, README.md, RULES.md, documentos LGPD</td></tr>
<tr><td>Histórico</td><td>Mantém registro de todas as gerações realizadas</td></tr>
</table>
<div class="page-break"></div>
<h1>3. Primeiros Passos</h1>
<div class="alert">
<h3>Passo a Passo</h3>
<ol>
<li>Acesse o sistema e faça login com suas credenciais</li>
<li>No menu lateral, clique em "Projetos de Prompt"</li>
<li>Clique em "Novo Projeto"</li>
<li>Preencha os dados da empresa (nome, endereço, WhatsApp, website, redes sociais)</li>
<li>Defina o Objetivo do projeto</li>
<li>Forneça o Contexto</li>
<li>Defina a Persona</li>
<li>Escolha o Tom/Estilo</li>
<li>Adicione Restrições importantes</li>
<li>Defina o Formato de Saída</li>
<li>Selecione o Provedor de IA</li>
<li>Clique em "Salvar"</li>
</ol>
</div>
<h2>3.1 Usando Templates</h2>
<p>Os templates são a maneira mais rápida de começar. Ao criar um novo projeto, digite no campo "Modelo de Projeto" para buscar entre os 36 templates disponíveis.</p>
<table>
<tr><th>Categoria</th><th>Templates</th></tr>
<tr><td>Landing Pages</td><td>Corporativa, SaaS, Produto Digital, Evento, E-book, Curso Online, App Mobile, Agência, Restaurante, Imobiliária, Saúde, Educação, Delivery</td></tr>
<tr><td>Sites</td><td>Institucional, Portfolio Profissional, Portfolio Criativo, Blog Pessoal</td></tr>
<tr><td>Sistemas</td><td>E-commerce, Sistema SaaS, Dashboard Admin</td></tr>
<tr><td>Frameworks</td><td>Laravel + Blade, Slim Framework, Vue.js + Vite, React + Vite, Next.js, Node.js + Express, FastAPI + Python</td></tr>
<tr><td>Arquitetura</td><td>Microsserviços, API REST, JWT, Chatbot com IA, Automação de Workflow</td></tr>
</table>
<p>Ao selecionar um template, todos os campos do formulário são preenchidos automaticamente com as configurações ideais para aquele tipo de projeto.</p>
<div class="page-break"></div>
<h1>4. Templates de Projeto</h1>
<h2>4.1 Estrutura de um Template</h2>
<table>
<tr><th>Campo</th><th>Descrição</th></tr>
<tr><td>Title</td><td>Nome do template</td></tr>
<tr><td>Objective</td><td>Objetivo principal do projeto</td></tr>
<tr><td>Context</td><td>Contexto e informações de fundo</td></tr>
<tr><td>Persona</td><td>Papel que a IA deve assumir</td></tr>
<tr><td>Tone</td><td>Tom e estilo de comunicação</td></tr>
<tr><td>Constraints</td><td>Restrições técnicas e regras</td></tr>
<tr><td>Output Format</td><td>Formato esperado do resultado</td></tr>
<tr><td>Examples</td><td>Exemplos de entrada/saída</td></tr>
<tr><td>Variables</td><td>Variáveis dinâmicas do projeto</td></tr>
<tr><td>Temperature</td><td>Criatividade da IA (0.0 a 1.0)</td></tr>
<tr><td>Max Tokens</td><td>Limite de tokens na resposta</td></tr>
<tr><td>Standard Files</td><td>Se inclui arquivos padrão (true/false)</td></tr>
</table>
<h2>4.2 Criando seus Próprios Templates</h2>
<p>Desenvolvedores podem criar templates personalizados. Basta acessar "Templates" -> "Novo" e preencher os dados no formato JSON:</p>
<pre>{
"title": "Meu Template",
"objective": "Criar um sistema...",
"persona": "Especialista em...",
"constraints": "Restrições...",
"standard_files": true
}</pre>
<div class="warning">
<h3>Importante</h3>
<p>O campo <code>standard_files</code> controla se os arquivos padrão serão incluídos. Para a maioria dos projetos, mantenha como true.</p>
</div>
<div class="page-break"></div>
<h1>5. Arquivos Padrão</h1>
<p>Um dos grandes diferenciais do GPrompt é a geração automática de arquivos essenciais para qualquer projeto profissional. Estes arquivos são gerados em duas camadas:</p>
<ol>
<li>Pelo sistema: O GPrompt gera os arquivos na seção "Arquivos Padrão do Projeto"</li>
<li>Pela IA: O prompt gerado instrui a criação destes mesmos arquivos com conteúdo completo</li>
</ol>
<h2>5.1 Os 6 Arquivos Padrão</h2>
<table>
<tr><th>Arquivo</th><th>Conteúdo</th></tr>
<tr><td>LICENSE</td><td>Licença MIT com nome da empresa e ano</td></tr>
<tr><td>README.md</td><td>Documentação completa do projeto</td></tr>
<tr><td>RULES.md</td><td>Regras de desenvolvimento e padrões de código</td></tr>
<tr><td>cookies.html</td><td>Banner de cookies LGPD completo (Aceitar/Recusar/Personalizar)</td></tr>
<tr><td>termos-de-uso.html</td><td>Termos de Uso conforme legislação brasileira</td></tr>
<tr><td>privacidade.html</td><td>Política de Privacidade conforme LGPD (Lei 13.709/2018)</td></tr>
</table>
<h2>5.2 Conformidade com a LGPD</h2>
<p>A Lei Geral de Proteção de Dados (Lei 13.709/2018) exige que sites e aplicativos que coletam dados pessoais tenham:</p>
<ul>
<li>Política de Privacidade clara e acessível</li>
<li>Termos de Uso com as condições do serviço</li>
<li>Banner de Cookies com opção de aceitar, recusar ou personalizar</li>
<li>Canais de contato do DPO</li>
<li>Prazo de resposta de até 15 dias úteis (Art. 19)</li>
</ul>
<p>Todos estes requisitos são atendidos automaticamente pelos arquivos padrão do GPrompt.</p>
<div class="page-break"></div>
<h1>6. Requisitos de Sistema</h1>
<p>Todo projeto gerado pelo GPrompt inclui automaticamente requisitos de sistema que garantem qualidade e conformidade.</p>
<h2>6.1 Design Responsivo</h2>
<p>Mobile-first é a abordagem padrão. Todo projeto gerado é responsivo em todos os tamanhos de tela: smartphones (320px), tablets (768px), desktops (1024px) e telas grandes (1440px).</p>
<h2>6.2 Dependências com Licença MIT</h2>
<p>Todas as dependências devem ter licença MIT ou permissiva para segurança jurídica em projetos comerciais:</p>
<ul>
<li>Ícones: Bootstrap Icons, Font Awesome (gratuito)</li>
<li>Fontes: Google Fonts</li>
<li>Imagens: Unsplash, Pexels (domínio público)</li>
<li>Frameworks: Bootstrap 5 (MIT), Vue.js (MIT), React (MIT)</li>
</ul>
<h2>6.3 Campo de Senha com Toggle</h2>
<p>Todo campo de senha deve incluir um botão com ícone "olho" para mostrar/esconder a senha, seguindo as melhores práticas de UX.</p>
<h2>6.4 SEO Completo</h2>
<ul>
<li>HTML5 semântico</li>
<li>Meta tags: title, description, keywords, viewport</li>
<li>Open Graph: og:title, og:description, og:image</li>
<li>JSON-LD: dados estruturados</li>
<li>Sitemap.xml e Robots.txt</li>
<li>Acessibilidade: aria labels, alt text</li>
</ul>
<div class="page-break"></div>
<h1>7. Provedores de IA</h1>
<p>O GPrompt suporta múltiplos provedores de Inteligência Artificial:</p>
<h2>7.1 OpenRouter</h2>
<p>Gateway que unifica dezenas de modelos de IA em um único ponto de acesso. Modelos: deepseek/deepseek-v4-flash, nvidia/nemotron-3, openai/gpt, google/gemma. Configure a OPENROUTER_API_KEY no .env.</p>
<h2>7.2 StepFun</h2>
<p>Provedor com modelos de alta performance. Modelos: step-3.5-flash, step-3.7-flash. Configure a STEPFUN_API_KEY no .env.</p>
<h2>7.3 Llama.cpp (Local)</h2>
<p>Execute modelos de IA localmente, sem depender de serviços externos. Modelos: Qwen3-8B, Llama-3.2-3B. Configure LLAMACPP_BASE_URL no .env.</p>
<h2>7.4 Escolhendo o Modelo Ideal</h2>
<table>
<tr><th>Para gerar</th><th>Modelo recomendado</th></tr>
<tr><td>Landing Pages HTML/CSS</td><td>deepseek/deepseek-v4-flash</td></tr>
<tr><td>Documentação</td><td>nvidia/nemotron-3-super</td></tr>
<tr><td>Sistemas complexos</td><td>openrouter/free</td></tr>
<tr><td>Projetos offline</td><td>Llama.cpp local (Qwen3-8B)</td></tr>
</table>
<div class="page-break"></div>
<h1>8. Casos de Uso Práticos</h1>
<h2>8.1 Landing Page Corporativa</h2>
<p>Cenário: Uma empresa precisa de uma landing page profissional para divulgar serviços B2B.</p>
<p>Solução: Selecione o template "Landing Page Corporativa", preencha os dados da empresa, gere o prompt com deepseek/deepseek-v4-flash, e use o prompt no VSCode para receber o projeto completo com index.html, style.css, LICENSE, README.md, cookies.html e os demais arquivos padrão.</p>
<h2>8.2 Sistema SaaS com Laravel + Vue.js</h2>
<p>Cenário: Desenvolvimento de um sistema SaaS completo com backend Laravel e frontend Vue.js.</p>
<p>Solução: Selecione o template "Laravel 13 + Vue.js 3 Fullstack" e gere o prompt. O resultado conterá instruções para criar toda a estrutura do sistema.</p>
<h2>8.3 API RESTful com Autenticação JWT</h2>
<p>Cenário: Criação de uma API REST com autenticação JWT.</p>
<p>Solução: Selecione o template "API com Autenticação JWT". O prompt gerará instruções para controllers, middleware, testes, e docker-compose.</p>
<h2>8.4 Chatbot com IA</h2>
<p>Cenário: Implementação de um chatbot com integração a provedores de IA.</p>
<p>Solução: Selecione o template "Chatbot com IA". O prompt incluirá interface de chat, histórico, e integração com API de IA.</p>
<div class="page-break"></div>
<h1>9. Boas Práticas</h1>
<h2>9.1 Criando Prompts Eficientes</h2>
<ul>
<li>Seja específico: "Criar um sistema de gestão de tarefas" é melhor que "Criar um sistema"</li>
<li>Forneça contexto: Explique o público-alvo e o ambiente técnico</li>
<li>Defina restrições claras: Tecnologias, frameworks, limitações</li>
<li>Use exemplos: Mostre à IA o formato esperado do resultado</li>
<li>Ajuste a temperatura: 0.3 para código preciso, 0.7 para criatividade balanceada</li>
</ul>
<h2>9.2 Dicas para Diferentes Modelos</h2>
<table>
<tr><th>Modelo</th><th>Dica</th></tr>
<tr><td>deepseek/deepseek-v4-flash</td><td>Excelente para código HTML/CSS/JS</td></tr>
<tr><td>nvidia/nemotron-3-super</td><td>Ótimo para documentação e prompts longos</td></tr>
<tr><td>Llama.cpp local</td><td>Ideal para projetos sensíveis</td></tr>
<tr><td>openrouter/free</td><td>Roteia para o melhor modelo gratuito</td></tr>
</table>
<h2>9.3 Versionamento e Manutenção</h2>
<ul>
<li>Sempre inclua LICENSE, README.md e RULES.md no repositório</li>
<li>Mantenha os documentos LGPD atualizados</li>
<li>Revise periodicamente os templates</li>
<li>Use o histórico de gerações para referência</li>
</ul>
<div class="page-break"></div>
<h1>10. Conclusão</h1>
<p>O GPrompt representa uma nova forma de desenvolver projetos web, combinando a potência da Inteligência Artificial com a estruturação profissional que todo projeto merece.</p>
<div class="alert">
<h3>O que você ganha usando o GPrompt</h3>
<ul>
<li>Produtividade: Gere projetos completos em minutos</li>
<li>Qualidade: Prompts otimizados produzem resultados superiores</li>
<li>Conformidade: LGPD, termos de uso e privacidade sempre inclusos</li>
<li>Padronização: Todos os projetos seguem as mesmas boas práticas</li>
<li>Flexibilidade: Escolha o modelo de IA ideal para cada tarefa</li>
<li>Controle: Você decide cada aspecto do projeto através dos templates</li>
</ul>
</div>
<p>Comece hoje mesmo a transformar sua forma de desenvolver. Crie seu primeiro projeto no GPrompt e experimente a diferença de ter um sistema que entende suas necessidades.</p>
<div class="box">
<h3>Continue Aprendendo</h3>
<ul>
<li>Explore os 36 templates disponíveis</li>
<li>Crie seus próprios templates</li>
<li>Experimente diferentes provedores de IA</li>
<li>Compartilhe templates com sua equipe</li>
</ul>
</div>
<div class="footer">
<p>GPrompt — Sistema de Geração de Prompts Inteligentes</p>
<p>© 2026 Syspanel. Todos os direitos reservados.</p>
</div>
</body>
</html>
+8
View File
@@ -116,4 +116,12 @@ Route::post('/cookie-consent', [App\Http\Controllers\Legal\CookieConsentControll
->middleware(['web']) ->middleware(['web'])
->name('cookie.consent.store'); ->name('cookie.consent.store');
Route::get('ebook/download', function () {
$path = public_path('ebooks/GPrompt-Ebook-Desenvolvedores-v1.pdf');
if (!file_exists($path)) {
abort(404, 'Ebook não encontrado');
}
return response()->file($path, ['Content-Type' => 'application/pdf']);
})->name('ebook.download');
require __DIR__.'/auth.php'; require __DIR__.'/auth.php';