smartbooster / core-bundle
将所有供应商、通用工具和服务打包在一起,这些是我们每个项目中使用的
v1.13.1
2024-09-24 15:23 UTC
Requires
- php: ^8.1
- doctrine/doctrine-fixtures-bundle: ^3.4
- doctrine/orm: ^2.13
- egulias/email-validator: ^3.0|^4.0
- nelmio/security-bundle: ^2.8 || ^3.0
- sentry/sentry-symfony: ^4.9
- symfony/apache-pack: ^1.0
- symfony/form: ^5.4|^6.2
- symfony/framework-bundle: ^5.4|^6.2
- symfony/security-bundle: ^5.4|^6.2
- symfony/translation: ^5.4|^6.2
- theofidry/alice-data-fixtures: ^1.5
Requires (Dev)
- smartbooster/standard-bundle: ^1.0
- symfony/flex: ^2
- symfony/phpunit-bridge: ^5.4|^6.2
- symfony/runtime: ^5.4|^6.2
- symfony/twig-bundle: ^5.4|^6.2
- dev-main
- v1.13.1
- v1.13.0
- v1.12.0
- v1.11.0
- v1.10.0
- v1.9.0
- v1.8.0
- v1.7.0
- v1.6.0
- v1.5.0
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-fix_history_colleciton_skip_field
- dev-clean_monitoring_command
- dev-CU-8695wmnkj_add_traits
- dev-allow_doctrine_orm_v3
This package is auto-updated.
Last update: 2024-09-24 15:23:56 UTC
README
将所有供应商、通用工具和服务打包在一起,这些是我们每个项目中使用的
里面有什么!
- 配置 IniOverrideConfig 服务,轻松覆盖 php.ini 选项
- 监控路由,用于正常运行时间跟踪、phpinfo 调试等
- DataFixtures 抽象助手
- 查询函数以扩展 Doctrine DQL 功能
- SentryCallback 具有特殊的 CleverCloud 专用行为
- Array、Date、Math、Regex 和 String 的实用工具
- EmailChain、Modulo、Password 等验证约束
安装
composer require smartbooster/core-bundle
启用监控路由
要启用监控路由,请将以下代码添加到您的 config/routes.yaml
文件中
_smart_core: resource: . type: smart_core # We recommand to restrict thoses routes on a secure subdomain host: "admin.%domain%"
路径 ^/anonymous
必须在项目的 security.yaml
配置中具有 PUBLIC_ACCESS
,以便探测路由可以无用户访问
# security.yaml access_control: - { path: ^/anonymous, roles: PUBLIC_ACCESS }
额外 DQL 函数
根据您的缺失功能需求,将以下代码添加到您的 config/packages/doctrine.yaml
文件中
doctrine: # ... orm: # ... dql: string_functions: group_concat: Smart\CoreBundle\Query\MySQL\GroupConcat
Sentry 配置
要使用我们的 SentryCallback,请将以下内容添加到您的 config/packages/sentry.yaml
文件中
when@prod: sentry: dsn: '%env(SENTRY_DSN)%' options: environment: '%env(ENVIRONMENT)%' before_send: 'sentry.callback.before_send' integrations: - 'Sentry\Integration\IgnoreErrorsIntegration' register_error_listener: false services: Sentry\Integration\IgnoreErrorsIntegration: arguments: $options: ignore_exceptions: - 'Symfony\Component\Security\Core\Exception\AccessDeniedException' sentry.callback.before_send: class: 'Smart\CoreBundle\Sentry\SentryCallback' factory: [ '@Smart\CoreBundle\Sentry\SentryCallback', 'getBeforeSend' ]
同时,在您的 config/packages/monolog.yaml
文件中声明以下内容
when@prod: monolog: handlers: # other handlers sentry: type: service id: Sentry\Monolog\Handler
并在您的 services.yaml 中定义 Sentry\Monolog\Handler
服务
services: # other services Sentry\Monolog\Handler: arguments: $hub: '@Sentry\State\HubInterface' $level: !php/const Monolog\Logger::ERROR
Nelmio 安全建议
我们建议在 nelmio 安全配方生成的配置基础上设置内容安全策略
nelmio_security: # ... # Content Security Policy csp: enabled: true hosts: [] content_types: [] enforce: # see full description below level1_fallback: true # only send directives supported by the browser, defaults to false # this is a port of https://github.com/twitter/secureheaders/blob/83a564a235c8be1a8a3901373dbc769da32f6ed7/lib/secure_headers/headers/policy_management.rb#L97 browser_adaptive: enabled: true # this is a full list of known case, you must keep only useful script in project script-src: - 'self' - 'unsafe-inline' - 'unsafe-eval' - 'https://maps.googleapis.com' - 'https://use.fontawesome.com' - 'https://#' - 'https://www.youtube.com' - 'https://www.youtube-nocookie.com' - 'https://js.stripe.com' - 'https://canny.io/' - 'https://www.google.com/' - 'https://www.gstatic.com/' - 'https://code.iconify.design' - 'https://cdn.jsdelivr.net.cn' - 'https://#' - 'https://#' block-all-mixed-content: true # defaults to false, blocks HTTP content over HTTPS transport
贡献
欢迎提交拉取请求。
感谢 所有已经做出贡献的人。
本项目由 SmartBooster 支持