babeuloula/cdn-php-bundle
Composer 安装命令:
composer require babeuloula/cdn-php-bundle
包简介
A proxy between your application and CDN PHP
README 文档
README
A Symfony Bundle for CDN PHP.
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
composer require babeuloula/cdn-php-bundle
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php file of your project:
// config/bundles.php return [ // ... BaBeuloula\CdnPhpBundle\CdnPhpBundle::class => ['all' => true], ];
Step 3: Configure the Bundle
# config/packages/cdn_php.yaml cdn_php: proxy: assets_path: 'mandatory' url: 'mandatory' check_assets: true # if the bundle needs to check if you have the file on the server before fetch from CDN PHP encrypted_parameters: false # if you need to hide the query parameters on your application encrypter: secret_key: null # Signs URLs generated by cdn_php() / cdn() Twig functions (app → browser). # Used to prevent tampering with query parameters on the public-facing proxy route. # Algorithm: SHA1(query_string + secret_key). Validated by Signer::isValid(). # Required when proxy.encrypted_parameters is true. cdn_secret_key: null # Signs requests sent by Proxy to the CDN PHP service (app → CDN). # Must match the SIGNATURE_SECRET environment variable set on the CDN PHP instance. # Algorithm: HMAC-SHA256(imageUrl:expires, cdn_secret_key). # Leave null if CDN PHP runs without SIGNATURE_SECRET. cdn_expires_ttl: 3600 # Validity duration (in seconds) of CDN request signatures. # Only used when cdn_secret_key is set. Default: 3600 (1 hour). twig: route_name: 'mandatory' # the route to the controller that displays the assets route_parameter: 'mandatory' # the route parameter name
Using a fallback handler
If you don't have access to CDN PHP or if you want to use it on local development, you can set up a fallback handler.
Actually, I only support Intervention Image v3.
Intervention\Image\Drivers\Imagick\Driver: ~ BaBeuloula\CdnPhpBundle\FallbackHandler\InterventionImageFallbackHandler: arguments: $assetsPath: '_your_path_' $driver: '@Intervention\Image\Drivers\Imagick\Driver' $cache: '_your_cache_instance_' BaBeuloula\CdnPhpBundle\FallbackHandler\FallbackHandlerInterface: '@BaBeuloula\CdnPhpBundle\FallbackHandler\InterventionImageFallbackHandler'
Contributing
Build and install dependencies
You can use the existing docker stack with the command make install to build the Dockerfile and install the composer
dependencies.
If you want to execute some commands through Docker, just use docker/exec your_command.
Run testing stack
# Run all tests make check # Execute PHPCS make lint # Execute PHPCS fixer make fixer # Execute PHPStan make analyse
babeuloula/cdn-php-bundle 适用场景与选型建议
babeuloula/cdn-php-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 91 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 babeuloula/cdn-php-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 babeuloula/cdn-php-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 91
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-09