定制 rayzenai/gold-silver-price 二次开发

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

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

rayzenai/gold-silver-price

Composer 安装命令:

composer require rayzenai/gold-silver-price

包简介

Laravel package for fetching and managing gold and silver prices with Filament integration

README 文档

README

A Laravel package for fetching and managing gold and silver prices from fenegosida.org with Filament integration.

Features

  • Automatic price fetching from fenegosida.org
  • Database storage of historical prices
  • Filament admin panel integration
  • Queue support for background fetching
  • Artisan command for manual fetching
  • Configurable source URL and settings
  • Full test coverage with Pest PHP

Installation

You can install the package via Composer:

composer require rayzenai/gold-silver-price

Publish the migration file (optional):

php artisan vendor:publish --tag="gold-silver-price-migrations"

Run the migrations:

php artisan migrate

Publish the config file (optional):

php artisan vendor:publish --tag="gold-silver-price-config"

Configuration

The package comes with a configuration file config/gold-silver-price.php where you can customize:

  • Source URL for fetching prices
  • Filament navigation settings
  • Database table name
  • HTTP client settings (timeout, retries, etc.)

Usage

Fetching Prices

Manually fetch prices using the Artisan command:

php artisan gold-silver-price:fetch

Or dispatch the job:

use RayzenAI\GoldSilverPrice\Jobs\FetchGoldPriceJob;

FetchGoldPriceJob::dispatch();

Scheduling Automatic Fetching

To automatically fetch prices every five minutes between 10:00 and 13:00, add the following to your routes/console.php file:

use Illuminate\Support\Facades\Schedule;
use RayzenAI\GoldSilverPrice\Jobs\FetchGoldPriceJob;

Schedule::job(FetchGoldPriceJob::class)
    ->everyFiveMinutes()
    ->between('10:00', '13:00');

Make sure your Laravel scheduler is running via cron:

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Using the Service

use RayzenAI\GoldSilverPrice\Services\GoldPriceService;

$service = app(GoldPriceService::class);
$goldPrice = $service->fetchAndStore();

// Get latest prices
$latest = $service->getLatest();

Filament Integration

Register the plugin in your Filament panel provider:

use RayzenAI\GoldSilverPrice\GoldSilverPricePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            GoldSilverPricePlugin::make(),
        ]);
}

Testing

The package includes comprehensive tests using Pest PHP. Run tests with:

cd /path/to/gold-silver-price
./vendor/bin/pest

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固