rbibby / laravel-dashboard-news-tile
NewsApi.org tile for Laravel Dashboard
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 2
pkg:composer/rbibby/laravel-dashboard-news-tile
Requires
- php: ^7.4
- spatie/laravel-dashboard: ^1.0
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2025-12-12 08:39:08 UTC
README
Displays latest news on your Laravel Dashboard using newsapi.org
This tile can be used on the Laravel Dashboard.
Installation
You can install the package via composer:
composer require rbibby/laravel-dashboard-news-tile
Configuration
In the dashboard config file, you must add this configuration in the tiles key.
The api-key option should contain your API key from https://newsapi.org/. It is recommended this is set in an env variable.
The country-code option sets which country to list news from. For a list of valid country codes, see the newsapi.org.uk documentation
The number-of-articles option determines how many articles to show on the dashboard.
The refresh-interval-in-seconds option determines how many seconds will pass before the dashboard tile is re-rendered.
// config/dashboard.php return [ // ... 'tiles' => [ 'news' => [ 'api-key' => env('NEWS_API_KEY'), 'country-code' => 'gb', 'number-of-articles' => 10, 'refresh-interval-in-seconds' => 60, ], ], ];
In app\Console\Kernel.php you should schedule the \RBibby\NewsTile\FetchDataFromApiCommand to run. You can let it run every minute if you want. You could also run it less frequently if fast updates on the dashboard aren't that important for this tile.
// app/Console/Kernel.php protected function schedule(Schedule $schedule) { // ... $schedule->command(\RBibby\NewsTile\FetchDataFromApiCommand::class)->everyMinute(); }
Usage
In your dashboard view you use the livewire:news-tile component.
<x-dashboard> <livewire:news-tile position="e7:e16" /> </x-dashboard>
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email hello@rbibby.co.uk instead of using the issue tracker.
Credits
Treeware
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.