定制 imagina/icurrency-module 二次开发

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

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

imagina/icurrency-module

Composer 安装命令:

composer require imagina/icurrency-module

包简介

This module manages currencies and conversions

README 文档

README

Installation

composer require imagina/icurrency

php artisan module:migrate Icurrency

php artisan db:seed --class=\\Modules\\Icurrency\\Database\\Seeders\\CurrencyTableSeederTableSeeder

Add middleware in acms/app/Http/Kernel.php

  protected $middleware = [
    // ...
      \Modules\Icurrency\Http\Middleware\CurrencyMiddleware::class,
    // ...
  ];

Note: This middleware expects the currency configuration within the object or from the request filter object. Example: api/iquote/v1/products?setting={"currency":"COP"} o api/iquote/v1/products?filter={"currency":"COP"}, 'settings' have higher priority.

Add command for updates TRM in acms/app/Console/Kernel.php

  protected $commands = [
    // ...
      Modules\Icurrency\Console\UpdateCurrencies::class
    // ...
  ];

Add .env your Api Key

Get your api key in currencyconverterapi

Free Forex API Rate Limits
Currency Pairs per Request: 2
Number of Requests per Hour: 100

CURRCONV_APIKEY=apikye

Run the following command the first time after making the migration to synchronize the currencies at the current exchange rate, after this they will be updated automatically with cron job.

php artisan currencies:update

Add command in schedule Laravel in acms/app/Console/Kernel.php

  protected function schedule(Schedule $schedule)
  {
    // ...
    $schedule->command(Modules\Icurrency\Console\UpdateCurrencies::class)->dailyAt('01:00');
    // ...
  }

Default Currencies Available

NAME CODE
United States Dollar USD
Colombian Peso COP
Australian dollar AUD
Mexican Peso MXN
Euro EUR

Use Facade Currency

Add follow line on the class that you need use this Facade:

use Modules\Icurrency\Support\Facades\Currency;

Methods Available

  • Convert a value:

      /* Example */
      Currency::convert(1000): 
  • Convert a value from one currency to another currency:

      /* Example */
      Currency::convertFromTo(1000, 'COP', 'AUD');
  • Get the current currency:

      /* Example */
      Currency::getLocaleCurrency();
  • Set current currency:

      /* Example */
      Currency::setLocaleCurrency('COP');
  • Get array with all current supported:

      /* Example */
      Currency::getSupportedCurrencies();

End Points

Route Base: https://yourhost/api/icurrency/v1/

  • Currencies

  • Attributes

    NAME TYPE NULLABLE TRANSLATABLE
    name String
    code String
    symbol_left String
    symbol_right String
    decimal_place char
    value double
    status tinyInteger
    default_currency boolean
    options text
    • Create.

      • Method: POST

      • Requires Authentication: ☑

      • Routes:

        • /currencies
      • Post params (Example):

        {
           attributes:{
             name: 'name',
             code: 'code',
             symbol_left: 'symbol_left',
             symbol_right: 'symbol_right',
             decimal_place: 'decimal_place',
             value: 'value',
             status: 'status',
             default_currency: 'default_currency',
           }
        }
        
    • Read

      • Method: GET

      • Requires Authentication: ☐

      • Routes:

        • /currencies
        • /currencies/id
      • Filters

        search
        date
        order
    • Update

      • Method: PUT
      • Requires Authentication: ☑
      • Routes:
        • /currencies/id
    • Delete

      • Method: DELETE
      • Requires Authentication: ☑
      • Routes:
        • /currencies/id

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固