定制 hireatlas/super-funds 二次开发

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

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

hireatlas/super-funds

最新稳定版本:1.0.0

Composer 安装命令:

composer require hireatlas/super-funds

包简介

Pull the latest list of superannuation funds directly from the Australian Government, right into your Laravel application.

README 文档

README

GitHub Tests Action Status Latest Version on Packagist Total Downloads

This package is a fairly lightweight Laravel wrapper around the service provided by the Australian government that lists all superannuation funds and products by their identifier (USI).

You can find the download here, and structural information about the download here.

We download the text file from this URL, then parse it into some DTOs which you can then save in your database, or use however you wish.

Installation

composer require hireatlas/super-funds

This package supports Laravel 10+, and PHP 8.1+.

Usage

Fetching the list of super funds as DTOs

To fetch the list of current super funds, you can call the fetch() method on the SuperFunds class. This will return a Collection of SuperFundDTO objects.

use Atlas\SuperFunds\SuperFunds;

/** @var SuperFunds $superFundsFetcher */
$superFundsFetcher = app(SuperFunds::class);

$superFunds = $superFundsFetcher->fetch();

dd($superannuationFunds);

Persisting the list of super funds as Eloquent models to your database

The package publishes a migration to store the super funds as Eloquent models in your database, so be sure to run php artisan migrate first before running the below.

To fetch and persist the list of current super funds to the database, you can call the persist() method on the SuperFunds class.

use Atlas\SuperFunds\SuperFunds;

/** @var SuperFunds $superFundsFetcher */
$superFundsFetcher = app(SuperFunds::class);

$superannuationFunds = $superFundsFetcher->persist();

dd($superannuationFunds);

Using a custom Eloquent model

You can use a custom Eloquent model by calling the useModel() method on the SuperFunds class. You should call this from the boot() method in your App\Providers\AppServiceProvider.

use App\Models\SuperFund as CustomSuperFundModel;
use Atlas\SuperFunds\SuperFunds;

public function boot() {
    SuperFunds::useModel(CustomSuperFundModel::class);
}

Disabling migrations

If you don't wish to use the default migration, or don't wish to persist models at all, then you can call the ignoreMigrations() method on the SuperFunds class. You should call this from the boot() method in your App\Providers\AppServiceProvider.

use Atlas\SuperFunds\SuperFunds;

public function boot() {
    SuperFunds::ignoreMigrations();
}

Regularly fetching the current list via task scheduling

The package includes both a command and a job for you to invoke from your App\Console\Kernel. They're equivalent, so use whichever method your prefer.

To avoid overloading the upstream service, please pick a random time of the day to fetch the list.

use Atlas\SuperFunds\Jobs\UpdateSuperFunds;

$schedule->command('super-funds:update')->dailyAt('01:23');
// OR
$schedule->job(new UpdateSuperFunds)->dailyAt('01:23');

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-05