robbens / laravel-dashboard-sl
Real time updates for public transport in Stockholm, Sweden.
2.0
2020-09-09 09:50 UTC
Requires
- php: ^7.4
- spatie/laravel-dashboard: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-12-30 01:34:08 UTC
README
A tile for Laravel Dashboard that shows real time public transport data from Stockholms Lokaltrafik.
Installation
You can install the package via composer:
composer require robbens/laravel-dashboard-sl
Usage
In your dashboard view you use the livewire:sl-tile
component.
<x-dashboard> <livewire:sl-tile position="a1:a2" /> </x-dashboard>
Configure config/dashboard.php
[ // ... 'tiles' => [ 'sl' => [ /** * API key to SL Real-time information 4 * * @link https://www.trafiklab.se/api/sl-realtidsinformation-4 */ 'api_key' => env('TRAFIKLAB_KEY'), /** * ID for the place for which the departures are to be collected, eg 9192 for Slussen. * This ID can be found using the "SL Location Lookup Console". * * @link https://www.trafiklab.se/api/sl-platsuppslag/konsol */ 'site_id' => 1079, /** * Optional label to show on the top of the tile. */ 'site_label' => 'Odenplan', /** * Get departures within the desired time window. Where the * time window is the number of minutes from now. Max 60. */ 'time_window' => 60, /** * Transport modes limit. */ 'buses' => [ 'total_limit' => 5, // Filter out early departures by minute. This is usually how long it takes to walk to the station. 'early_departures_limit' => 5, ], 'metros' => [ 'total_limit' => 5, 'early_departures_limit' => null, ], 'trains' => false, ], ] ]
Schedule the command in app/Console/Kernel.php
.
protected function schedule(Schedule $schedule) { $schedule->command(Robbens\SlTile\FetchDataFromSLApiCommand::class)->everyMinute(); }
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 yo@robin.se instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.