tjvb / laravel-dashboard-packagist-tile
一个Laravel Dashboard的Tile,显示来自Packagist的统计数据。
Requires
- php: ^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0
- illuminate/support: ^7.0 || ^8.0 || ^9.0 || ^10.0
- livewire/livewire: ^1.0 || ^2.0
- spatie/laravel-dashboard: ^1.0 || ^2.0
- spatie/packagist-api: ^2.0
Requires (Dev)
- fakerphp/faker: ^1.9
- orchestra/testbench: ^5.2 || ^6.0 || ^7.0 || ^8.0
- phpmd/phpmd: ^2.13
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: ^3.5
README
此包在没有新维护者的情况下不会更新,请参阅:https://gitlab.com/tjvb/laravel-dashboard-packagist-tile/-/issues/10
在Spatie Laravel下载的Tile中显示Packagist下载
此Tile可用于Laravel Dashboard,以显示关于您想查看的包的Packagist统计信息。您可以隐藏废弃的包和包的总数。它还支持分页。
安装
您可以通过composer安装此包
composer require tjvb/laravel-dashboard-packagist-tile
在dashboard
配置文件中,您必须在tiles
键中添加此配置。并根据您的需求进行自定义。
// in config/dashboard.php
return [
'tiles' => [
'packagist' => [
'refresh_interval_in_seconds' => 300,
'sort' => 'total', // options: name, daily, monthly, total, empty means no sorting.
'reverse' => true, // reverse the order
'with_abandoned' => true, // set to false to ignore them
'display' => [
'totals' => true,
'faves' => true, // packagist faces
'github_stars' => true, // github stars
],
'vendors' => [ // vendors from which you want to see all the packages
'tjvb',
'spatie',
],
'packages' => [ // specific packages that you want to see.
'phpmd/phpmd',
'pdepend/pdepend',
],
],
],
];
要从Packagist加载数据,有两个命令可以安排。FetchPackageDataCommand获取包的统计数据。这将被缓存12小时,因此每天获取两次以上没有意义。请参阅Packagist API文档
第二个命令是获取您已配置的供应商的包。如果您创建了大量的包,如来自Spatie的伟大的人,这可能很有用。否则,您最好在Packagist上发布新包后运行php artisan dashboard:fetch-vendor-packages-from-packagist
。
// in app/console/Kernel.php
protected function schedule(Schedule $schedule)
{
// ...
$schedule->command(\TJVB\PackagistTile\FetchPackageDataCommand::class)->twiceDaily();
// Additional if the vendors you watch release a lot of packages.
// Else be nice and do it manually with php artisan dashboard:fetch-vendor-packages-from-packagist.
// $schedule->command(\TJVB\PackagistTile\FetchVendorPackagesCommand::class)->daily();
}
用法
在您的仪表板视图中,您使用livewire:packagist-tile
组件。
<x-dashboard>
<livewire:packagist-tile position="e7:e16" />
</x-dashboard>
分页
包是分页的,默认情况下,每页最多有10个包。这可以通过向Tile添加perPage属性来更改。
<x-dashboard>
<livewire:packagist-tile position="e7:e16" perPage="2" />
</x-dashboard>
自定义视图
如果您想自定义用于渲染此Tile的视图,请运行此命令
php artisan vendor:publish --provider="TJVB\PackagistTile\PackagistTileServiceProvider" --tag="dashboard-packagist-views"
测试
composer test
更改日志
请参阅CHANGELOG以获取有关最近更改的更多信息。
贡献
请参阅CONTRIBUTING以获取详细信息。
安全
如果您发现任何与安全相关的问题,请通过info@tjvb.nl发送电子邮件,而不是使用问题跟踪器。
鸣谢
感谢
- Spatie提供的dashboard和packagist api package。
- Packagist提供的优秀服务。
- Tailwind CSS的前端预设用于分页预设。
许可证
MIT许可证(MIT)。请参阅许可证文件以获取更多信息。