hireatlas/super-funds
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
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.
hireatlas/super-funds 适用场景与选型建议
hireatlas/super-funds 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 12 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 hireatlas/super-funds 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hireatlas/super-funds 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-05