l3/photo-bundle
Composer 安装命令:
composer require l3/photo-bundle
包简介
PhotoBundle client for RefPhoto Symfony2/Symfony3/Symfony4/Symfony5/Symfony6/Symfony7
README 文档
README
This bundle is a client for the referencial Photo (https://github.com/l3-team/RefPhoto) or (https://github.com/l3-team/RefPhotoJ2EE)
Pre-requisites
- have a RefPhoto instance installed (https://github.com/l3-team/RefPhoto) or (https://github.com/l3-team/RefPhotoJ2EE)
- have a Symfony 2 or Symfony3 or Symfony4 application
Installation
Install the Bundle with this command :
composer require l3/photo-bundle:~1.0
For Symfony 2 and Symfony3, add the Bundle in AppKernel.php
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new L3\Bundle\PhotoBundle\L3PhotoBundle(),
);
// ...
}
// ...
}
For Symfony4, add the bundle in config/bundles.php file (add the line if not present) :
<?php
// config/bundles.php
return [
...
L3\Bundle\PhotoBundle\L3PhotoBundle::class => ['all' => true],
...
];
Configuration
For Symfony2 and Symfony3, add and adapt the 3 variables for configuration in the app/config/parameters.yml.dist and app/config/parameters.yml :
# app/config/parameters.yml.dist
# app/config/parameters.yml
parameters:
photo_enabled: true
photo_image_url: 'https://refphotos.univ.fr/image/'
photo_token_url: 'https://refphotos.univ.fr/token/add'
Next add the variable %photo_enabled% in app/config/config.yml under twig globals :
# app/config/config.yml
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
globals:
photo_enabled: '%photo_enabled%'
For Symfony4, add and adapt the 3 variables for configuration in the .env.local and .env :
# .env.local
# .env
###> l3/photo-bundle ###
PHOTO_ENABLED=true
PHOTO_IMAGE_URL=https://refphotos.univ.fr/image/
PHOTO_TOKEN_URL=https://refphotos.univ.fr/token/add/
###< l3/photo-bundle ###
and add the 3 variables under parameters in the config/services.yaml file :
# config/services.yaml
parameters:
photo_enabled: '%env(bool:PHOTO_ENABLED)%'
photo_image_url: '%env(string:PHOTO_IMAGE_URL)%'
photo_token_url: '%env(string:PHOTO_TOKEN_URL)%'
and the variable %photo_enabled% in config/packages/twig.yaml under twig globals :
# config/packages/twig.yaml
# Twig Configuration
twig:
paths: ['%kernel.project_dir%/templates']
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
globals:
photo_enabled: '%photo_enabled%'
How to use
In your twig views you can use it like this :
{% if photo_enabled %}
<img src="{{ photo(p.uid) }}" alt="photo inexistante" />
{% endif %}
l3/photo-bundle 适用场景与选型建议
l3/photo-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 l3/photo-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 l3/photo-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 38
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2017-02-28