承接 sirvoy/twig-bulma-form-theme-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sirvoy/twig-bulma-form-theme-bundle

Composer 安装命令:

composer require sirvoy/twig-bulma-form-theme-bundle

包简介

A Twig Form Theme for Bulma for use with Symfony

README 文档

README

A Twig 3.x Form Theme for Bulma 0.9.x for use with Symfony 5/6 framework

Twig (3.x) Bulma (v0.9.x) Form theme

Bulma is a modern CSS framework based on Flexbox. This form theme was created for use with the Twig Template engine. Twig is a modern template engine for PHP.

This form theme was built to work with Twig in combination with the Symfony Framework for websites built on top of the Bulma CSS framework.

Index

How to use the form theme:

The easiest way to make use of the form theme in Symfony is to set this form theme in the configuration file. Have a look at the Symfony documentation. Also example files are provided in this repository.

Icon support:

The theme also supports the use of icons. Bulma comes with support for the Font Awesome icon toolkit. It's realy easy to make a form widget support these themes with Symfony Form Type Extensions. An example Form Type Extension is provided within the examples directory in this repository.

Examples

widget sizes:

Widget size can be set by just using a classname. The following example is for use with the Symfony Form Type.

$builder->add('firstname', TextType::class, [
    'attr' => [
        'class' => 'is-large'
    ],
    ...
]);

Selectbox size example

NOTE

The default size needs no extra class. Suppoted sizes are is-small, is-medium and is-large.

Icons:

The following example is for use with the Symfony Form Type. This example is based on the Form Type Extension provided in the documentation examples directory.

$builder
    // Username widget with user icon
    ->add('username', TextType::class, [
	    'bulma_icon' => [
            'icon' => 'user',
            'position' => 'left',
        ],
        ...
    ])
    // Password widget with lock icon
    ->add('password', PasswordType::class, [
        'bulma_icon' => [
            'icon' => 'lock',
            'position' => 'left',
        ],
        ...
    ])
;

Username and password widgets with icons

Need more icons?

Have a look at the bulma.io and fontawesome.io website to find out which icons are available and how to implement them.

Dropdown with ChoiceType:

The following example is for use with the Symfony Form Type 'ChoiceType'

->add('checkbox_dropdown', Type\ChoiceType::class, [
    'choices' => [
        // choice groups are supported (including 'group_by' method)
        'Group header 1' => [
            'Checkbox 1' => 1,
            'Checkbox 2' => 2,
        ],
        'Group header 2' => [
            'Checkbox 3' => 3,
            'Checkbox 4' => 4,
        ],
    ],
    'label' => false, // = don't render top label (trigger button label is always rendered)
    'expanded' => true, // required to use dropdown
    'multiple' => true, // true = checkboxes, false = radio buttons
    'attr' => [
        'dropdown' => true, // required to use dropdown
        'dropdown_arrow_icon' => false, // default to true
        'class' => 'is-rounded is-outlined', // added to dropdown trigger button
    ],
])

Render it inside a form:

<!-- easiest way to render -->
{{ form_row(form.checkbox_dropdown) }}

<!-- if you need to customize a little bit -->
<div class="field">
    <!-- remove form_label() if you don't want the top label -->
    <!-- but still a customizable label inside dropdown trigger button -->
    {{ form_label(form.checkbox_dropdown) }}
    <div class="dropdown">
        {{ form_widget(form.checkbox_dropdown) }}
    </div>
</div>

Dropdown with ChoiceType

Add this styling if you need a scrollbar on your dropdowns

.dropdown-content {
  max-height: 25rem;
  overflow-y: auto;
}

Sources

Have a look at the following websites and their documentation for more information about this subject.

  • The Bulma CSS framework website;
  • The Font Awesome font and CSS toolkit;
  • The Twig Template engine for PHP website;
  • The Symfony PHP framework website.

sirvoy/twig-bulma-form-theme-bundle 适用场景与选型建议

sirvoy/twig-bulma-form-theme-bundle 是一款 基于 Twig 开发的 Composer 扩展包,目前已累计 914 次下载、GitHub Stars 达 32, 最近一次更新时间为 2023 年 05 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「symfony」 「twig」 「theme」 「bulma」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 sirvoy/twig-bulma-form-theme-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sirvoy/twig-bulma-form-theme-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 sirvoy/twig-bulma-form-theme-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 914
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 32
  • 点击次数: 31
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 32
  • Watchers: 5
  • Forks: 12
  • 开发语言: Twig

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-18