Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Dashboard Belgian Trains Tile

Laravel Dashboard Belgian Trains Tile Laravel Package

spatie/laravel-dashboard-belgian-trains-tile

Laravel Dashboard tile that shows Belgian train connections and their current status. Add it to your Spatie dashboard to monitor departures/arrivals and stay on top of delays and cancellations at a glance.

View on GitHub
Deep Wiki
Context7

A tile for Laravel-dashboard that displays the schedule of Belgian trains

Frequently asked questions about Laravel Dashboard Belgian Trains Tile
How do I add the Belgian train tile to my existing Laravel Dashboard?
First, ensure you have Laravel Dashboard installed (`composer require spatie/laravel-dashboard`). Then install the tile with `composer require spatie/laravel-dashboard-belgian-trains-tile`. Add the tile to a dashboard panel using Blade: `<x-belgian-trains-tile station='Brussels' />`. No additional configuration is needed unless you customize styling or API credentials.
What Laravel and PHP versions does this package support?
This package requires **Laravel 9 or 10** and **PHP 8.0+**. It is designed for Spatie’s Laravel Dashboard (v1.x+), so ensure your dashboard version is compatible. Check the [Laravel Dashboard docs](https://docs.spatie.be/laravel-dashboard) for version-specific requirements.
Do I need an NMBS API key to use this tile?
Yes, the tile relies on the **NMBS/SNCB API**, which requires an API key. Register for one on the [NMBS Developer Portal](https://developer.sncb.be) (if available) or contact NMBS for access. Store the key in your `.env` file as `NMBS_API_KEY=your_key_here`. Rate limits apply—check NMBS’s terms for production usage.
Can I customize the tile’s styling to match my dashboard theme?
The tile uses **Tailwind CSS** by default, but you can override styles by extending Spatie’s theme system or targeting specific classes in your CSS. For example, modify the `belgian-trains-tile` class or use Tailwind’s `@apply` directive. If using Livewire/Inertia, ensure your theme variables align with the tile’s output.
What happens if the NMBS API is down or rate-limited?
The package has **no built-in caching or fallback mechanisms**, so API downtime or rate limits will break the tile. Mitigate this by caching responses in **Redis** (e.g., with Laravel’s cache system) or implementing a retry logic with exponential backoff. Display a user-friendly error message if the API fails to respond.
Does this tile work with Livewire or Inertia for dynamic updates?
The tile is **compatible with Livewire/Inertia** if your Laravel Dashboard uses these for reactivity. However, test it in your specific setup, as dynamic updates depend on how the dashboard renders tiles. For Livewire, ensure the tile’s data is bound to a property; for Inertia, verify the API calls are proxied correctly.
Are there alternatives if I need train data for other countries (e.g., France, Germany)?
This package is **Belgium-specific** and relies on the NMBS API. For other regions, check if the rail operator offers an API (e.g., SNCF for France, DB for Germany) and build a custom tile using Spatie’s `Tile` base class. Alternatively, explore third-party transit APIs like [Transloc](https://transloc.com/) or [OpenTripPlanner](https://www.opentripplanner.org/).
How do I test the tile locally before deploying to production?
Run the package tests with `composer test` to verify basic functionality. For integration testing, mock the NMBS API using tools like **VCR** or **Pest’s fake HTTP responses** to simulate API calls without hitting rate limits. Test edge cases like invalid stations, API errors, and empty responses to ensure graceful degradation.
Can I use this tile in a non-Laravel dashboard (e.g., React/Vue standalone)?
No, this tile is **tightly coupled to Laravel Dashboard** and its Blade/Livewire/Inertia ecosystem. For non-Laravel dashboards, you’d need to rebuild the functionality from scratch or adapt Spatie’s `Tile` base class to your framework. The NMBS API integration is Laravel-agnostic, but the UI components are dashboard-specific.
What train data does the tile display, and can I extend it?
The tile shows **basic train connections** (departure/arrival times, station names, and possibly train types like IC or IC-IR). To extend it, subclass the tile’s logic (e.g., add delays, platform numbers, or real-time tracking) by overriding methods in a custom tile class. Modify the NMBS API response parsing in the service layer to include additional fields.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport