thealgoslingers/autoprice
最新稳定版本:v2.2.0
Composer 安装命令:
composer require thealgoslingers/autoprice
包简介
The AutoPrice class provides functionalities for calculating prices dynamically based on the user's location.
README 文档
README
Leverage real-time data and advanced algorithms to calculate prices bases on the user's location with Autoprice.
Requirements
Please obtain Api Key from IP2LOCATION.IOInstallation
composer require thealgoslingers/autoprice
Usage
NOTE:Autoprice returns the (converted) currency with it's associated currency code. So it will not be necessary to manually add the currency(it's) code again at the end. For instance, "10" from USD to Ghanaian cedis, Autoprice will return "GHS15.152" instead of just "15.532".
Some Api plans do not include the country's currency code. In this case, the raw figures will be returned. I.e. Amount without a currency code.
See ip2location for more details.
<?php
require 'vendor/autoload.php';
use thealgoslingers\AutoPrice;
// Usage example
$api_key = 'your_api_key_here'; // api key from ip2location.io
// the default base price is approximately
// or same as 1 USD. So we assume price is
// being converted from USD
$base_price = 100.0;//base price to be converted from
$dp = new AutoPrice($api_key, $base_price);
$user_ip = '8.8.8.8';// ip of the user
echo $dp->calculatePrice($user_ip);
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-07-13