定制 heureka-agency/switcheroo 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

heureka-agency/switcheroo

Composer 安装命令:

composer require heureka-agency/switcheroo

包简介

TALL-stack currency switcher for LiveWire.

README 文档

README

Latest Version on Packagist Total Downloads

Under the hood, Switcheroo is a single Livewire component with some AlpineJS magic sprinkled on top. The component uses and requires TailwindCss for it's styling, but you're free to change to any other CSS framework or even native CSS if you wish.

This package does not offer any currency conversion features yet.

Installation

You can install the package via composer:

composer require heureka-agency/switcheroo

You will also need to install the flag-icons npm package to display currency flags:

npm install flag-icons

Usage

Config

First, publish the Switcheroo config with the following command:

php artisan vendor:publish --tag=switcheroo-config
return [
    /**
     * Add any currencies you would like to handle with Switcheroo.
     * You can select all currencies using \HeurekaAgency\Switcheroo\Enums\Currency::all()
     */
    'enabled_currencies' => [
        \HeurekaAgency\Switcheroo\Enums\Currency::EUR,
        \HeurekaAgency\Switcheroo\Enums\Currency::USD,
        \HeurekaAgency\Switcheroo\Enums\Currency::GBP,
    ],

    /**
     * Set the default currency of the currency switcher.
     */
    'default_currency' => \HeurekaAgency\Switcheroo\Enums\Currency::EUR
];

Including in your app

Make sure to import the Switcheroo CSS in your app.css:

@import "../../vendor/heureka-agency/switcheroo/resources/css/switcheroo.css";

Then simply include the Switcheroo component wherever you'd like:

<livewire:switcheroo::currency-switcher /> 

Events

Switcheroo sends a single Livewire event every time a currency is selected. You can freely access this event from any other Livewire component or even from Javascript.

#[On('currency-selected')]
public function yourCurrencySwitchHandler(string $currency): void
{
    $currency = Currency::from($currency);
    // any other business logic
} 

The selected currency is also stored in local storage using Alpine.$persist.

Views

You're free to publish the Switcheroo views to customize the look and feel of the currency switcher:

php artisan vendor:publish --tag=switcheroo-views 

Translations

Switcheroo is multilingual ready! Not that it has any readable strings to translate, but nonetheless, you can publish the language files using:

php artisan vendor:publish --tag=switcheroo-translations 

Future plans

  • create a helper to automatically convert currencies based on the current selection
  • add support for language and country selection
  • add support for native language display of currencies/languages/countries

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email thar.tristan@heureka-kreativ.hu instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

heureka-agency/switcheroo 适用场景与选型建议

heureka-agency/switcheroo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 33 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 07 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 heureka-agency/switcheroo 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-18