tjvb/laravel-dashboard-packagist-tile

一个Laravel Dashboard的Tile,显示来自Packagist的统计数据。

1.8.0 2023-11-24 10:49 UTC

This package is auto-updated.

Last update: 2024-09-15 20:40:57 UTC


README

此包在没有新维护者的情况下不会更新,请参阅:https://gitlab.com/tjvb/laravel-dashboard-packagist-tile/-/issues/10

在Spatie Laravel下载的Tile中显示Packagist下载

Latest Stable Version Pipeline status Coverage report Tested on PHP 7.4 to 8.3 Tested on Laravel 9 to 10 Latest Unstable Version

PHP Version Require Laravel Version Require Livewire Version Require PHPMD PHPCS

License

Packagist data tile screenshot

此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发送电子邮件,而不是使用问题跟踪器。

鸣谢

感谢

许可证

MIT许可证(MIT)。请参阅许可证文件以获取更多信息。