承接 typicms/laravel-translatable-bootforms 相关项目开发

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

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

typicms/laravel-translatable-bootforms

Composer 安装命令:

composer require typicms/laravel-translatable-bootforms

包简介

Empowers typicms/bootforms with typicms/laravel-translatable.

README 文档

README

Latest Version on Packagist Actions Status PHPStan Pint Rector Coverage Status

Make BootForms work flawlessly with Laravel Translatable!

By importing this package, generating translatable forms using BootForms is a breeze.

Installation

  1. Run the Composer require command to install the package, the service provider will be autodiscovered by Laravel.

    composer require typicms/laravel-translatable-bootforms
    
  2. In your app config, add the Facade to the $aliases array

    'aliases' => [
        ...
        'TranslatableBootForm' => TypiCMS\LaravelTranslatableBootForms\Facades\TranslatableBootForm::class,
    ],
  3. Publish the configuration file

    php artisan vendor:publish --provider="TypiCMS\LaravelTranslatableBootForms\TranslatableBootFormsServiceProvider" --tag="config"

Usage

Simply use the TranslatableBootForm Facade as if it were BootForm! That’s it. Multiple form inputs will now be generated for the locales set in Translatable’s configuration file. They will have the corresponding value for each language and will save all of the translations without any code manipulation.

Please review BootForms’ documentation if you’re unsure how to use it.

Example:

// View
{!! BootForm::text('Name', 'name')
            ->placeholder('My placeholder') !!}

// Output
<div class="form-group">
    <label for="name">Name</label>
    <input type="text" name="name" class="form-control" placeholder="My Placeholder">
</div>

// Controller
public function postEdit($request)
{
    $someModel->save($request->all());
}
// View
{!! TranslatableBootForm::text('Name', 'name')
                        ->placeholder('My placeholder') !!}

// Output
<div class="form-group form-group-translation">
    <label for="name[en]">Name (en)</label>
    <input type="text" name="name[en]" class="form-control" placeholder="My Placeholder" data-language="en">
</div>
<div class="form-group form-group-translation">
    <label for="name[nl]">Name (nl)</label>
    <input type="text" name="name[nl]" class="form-control" placeholder="My Placeholder" data-language="nl">
</div>

// Controller
public function postEdit($request)
{
    $someModel->save($request->all());
}

You can use the %name and %locale placeholders while specifying parameters. The placeholder will be replaced with the corresponding input name or locale. This can be useful for two-way data binding libraries such as Angular.js or Vue.js. E.g.

{!! TranslatableBootForm::text('Title', 'title')
                        ->attribute('some-attribute', 'Name: %name')
                        ->attribute('another-attribute', 'Locale: %locale') !!}

// Output
<div class="form-group form-group-translation">
    <label for="title[en]">Title (en)</label>
    <input type="text" name="title[en]" class="form-control" some-attribute="Name: title[en]" another-attribute="Locale: en" data-language="en">
</div>
<div class="form-group form-group-translation">
    <label for="title[nl]">Title (nl)</label>
    <input type="text" name="title[nl]" class="form-control" some-attribute="Name: title[nl]" another-attribute="Locale: nl" data-language="nl">
</div>

To render a form element only for some chosen locales, explicitly call renderLocale() as the final method and pass the locale or an array of locales as the first parameter:

TranslatableBootForm::text('Name', 'name')
                    ->renderLocale('en')

If you need to apply a method only for certain locales, suffix the method with ForLocale and pass the locale or an array of locales as the first parameter:

TranslatableBootForm::text('Name', 'name')
                    ->dataForLocale('en', 'attributeName', 'attributeValue')
                    ->addClassForLocale(['en', 'nl'], 'addedClass')

For customizing the locale indicator in the label (and several other settings), please take a look at the configuration file.

typicms/laravel-translatable-bootforms 适用场景与选型建议

typicms/laravel-translatable-bootforms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 31.38k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2016 年 04 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 typicms/laravel-translatable-bootforms 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 31.38k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 6
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-15