ivannofick/laravelminifyobfuscate
Composer 安装命令:
composer require ivannofick/laravelminifyobfuscate
包简介
Obfuscate your Blade templates in Laravel by encrypting HTML, CSS, and JS into one HTML file.
关键字:
README 文档
README
Obfuscate your Blade templates in Laravel by encrypting HTML, CSS, and JS into one HTML file
Introduction
The "Laravel Minify Obfuscate" package allows you to enhance the security of your Laravel Blade templates by obfuscating and encrypting the HTML, CSS, and JavaScript code into a single HTML file. This makes it harder for potential attackers to access and understand your frontend code. The package achieves this by providing middleware that automatically processes the Blade templates and minifies/obfuscates the output.
This README.md file will guide you through the process of setting up and using the package in your Laravel application.
Installation
- Install the package via Composer by running the following command:
composer require ivannofick/laravelminifyobfuscate
- After the package is installed, publish the package configuration file and assets using the following Artisan command:
php artisan vendor:publish --provider="Ivannofick\Laravelminifyobfuscate\MinifyObfuscateProvider"
Middleware Setup
To enable the minification and obfuscation for your Blade templates, you need to add the provided middleware to your application's kernel. Follow these steps:
- Open the app/Http/Kernel.php file in your Laravel project.
- Locate the $middleware array and add the following middleware classes:
\Ivannofick\Laravelminifyobfuscate\Middleware\MinifyHtml::class,
\Ivannofick\Laravelminifyobfuscate\Middleware\MinifyJavascript::class,
The final $middleware array should look something like this:
protected $middleware = [
// Other middleware classes...
\Ivannofick\Laravelminifyobfuscate\Middleware\MinifyHtml::class,
\Ivannofick\Laravelminifyobfuscate\Middleware\MinifyJavascript::class,
];
- Save the changes to the Kernel.php file.
Conditional Obfuscation
The "Laravel Minify Obfuscate" package also provides a feature called "laravel_obfuscate_conditional," which allows you to enable or disable the obfuscation based on a configuration setting. This can be useful when you want to control whether obfuscation should be active in certain environments or scenarios.
- To use the
laravel_obfuscate_conditionalfeature, follow these steps: - Open the config/minifyobfuscate.php configuration file. Find the laravel_obfuscate_conditional setting and set it to either true or false as per your requirement:
'laravel_obfuscate_conditional' => true,
Setting it to true will activate the obfuscation, while setting it to false will deactivate it.
3. Save the changes to the configuration file.
Usage
With the package installed, middleware set up, and conditional obfuscation configured, your Blade templates' obfuscation will be based on the value of the LARAVEL_OBFUSCATE_SECURE_KEY setting. If it is set to true, obfuscation will be active, and if it is set to false, obfuscation will be disabled.
Please note that this conditional obfuscation setting adds flexibility, allowing you to enable or disable obfuscation as needed for different environments or scenarios.
Conclusion Congratulations! You have successfully set up "Laravel Minify Obfuscate" to protect your Blade templates in Laravel. Your frontend code is now minified and obfuscated, improving the security of your application.
If you encounter any issues or want to contribute to the package, please check out the GitHub repository.
Happy coding!
ivannofick/laravelminifyobfuscate 适用场景与选型建议
ivannofick/laravelminifyobfuscate 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 330 次下载、GitHub Stars 达 4, 最近一次更新时间为 2023 年 08 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「obfuscate」 「php8」 「php7.4」 「js-obfuscate」 「obfuscate using php」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ivannofick/laravelminifyobfuscate 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ivannofick/laravelminifyobfuscate 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ivannofick/laravelminifyobfuscate 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Provides hash tools for Laravel.
Replaces the default email address spam protection with a better one. The email obfuscation is more randomized, safer and more user friendly for the website visitor.
PhpPlaisio: Obfuscator
♺ Laravel Nova Hashids card. Convert your ids.
PhpPlaisio: Core Obfuscator
Fix Me a Link is a Craft plugin with link utility functions.
统计信息
- 总下载量: 330
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-02