Download the PHP package carshub/carshub-connector without Composer
On this page you can find all versions of the php package carshub/carshub-connector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package carshub-connector
CarsHub Connector
A Laravel package that connects your crew's website to CarsHub. It pulls pages, events, members, and cars from the CarsHub API and keeps them in a local JSON cache so your site stays fast and responsive even when the CarsHub API is unavailable.
How it works
- Stale-while-revalidate — every read returns immediately from cache. If the cache is fresh the request never touches the API. If the cache is stale, the stale data is returned while the scheduler refreshes it in the background.
- First-run sync — when no cache files exist the connector fetches all data on first boot and stores it, so your pages work from the first request.
- Scheduled refresh — register
php artisan schedule:runas a cron job once and the connector handles the rest:- Pages and settings → refreshed daily
- Events, members, cars, stats → refreshed hourly
Requirements
- PHP 8.2+
- Laravel 10, 11, 12, or 13
Installation
Publish the config file:
Add your credentials to .env:
You can find CARSHUB_API_KEY and CARSHUB_CREW_SLUG in Crew Settings → Website Sync on carshub.nl. The CARSHUB_EVENT_IMPORT_KEY is shown when the crew is created via the crews:create-system command.
Make sure Laravel's scheduler is running:
Usage
Blade / controllers
Event import (system-managed crews only)
If your crew is a system-managed crew with an CARSHUB_EVENT_IMPORT_KEY configured, you can write events directly from your application. All write methods throw CarsHubApiException on failure — wrap them in a try/catch.
After each write the local events cache (events.upcoming, events.past, and the event detail if cached) is invalidated automatically, so the next read will return fresh data.
Artisan commands
Configuration
All options are in config/carshub.php after publishing.
| Key | Default | Description |
|---|---|---|
api_key |
env('CARSHUB_API_KEY') |
API key from Crew Settings → Website Sync |
crew_slug |
env('CARSHUB_CREW_SLUG') |
Your crew's URL slug |
api_base_url |
https://carshub.nl/api |
CarsHub API base URL |
event_import_key |
env('CARSHUB_EVENT_IMPORT_KEY') |
Event import key (system-managed crews only) |
cache.path |
carshub |
Subdirectory under storage/ for JSON files |
cache.ttl.pages |
86400 |
Page cache TTL in seconds (24 h) |
cache.ttl.events |
3600 |
Events cache TTL in seconds (1 h) |
cache.ttl.members |
3600 |
Members cache TTL in seconds (1 h) |
sync_on_boot |
true |
Dispatch a sync job on first boot if cache is empty |
timeout |
10 |
HTTP request timeout in seconds |
Cache files
Cached data is stored as JSON files under storage/carshub/:
Each file looks like:
You can safely delete any of these files — the connector will re-fetch on next read.
Troubleshooting
Pages return null
Check that CARSHUB_API_KEY and CARSHUB_CREW_SLUG are set and that the Website Sync module is enabled in your crew settings on CarsHub.
Cache is always stale
Run php artisan carshub:status to see when each key was last fetched. Run php artisan carshub:sync --force to refresh immediately. Make sure schedule:run is registered in your crontab.
Events don't update
Events refresh every hour. Run php artisan carshub:sync --type=events --force to refresh now.
All versions of carshub-connector with dependencies
illuminate/support Version ^10|^11|^12|^13
illuminate/http Version ^10|^11|^12|^13
illuminate/console Version ^10|^11|^12|^13
illuminate/contracts Version ^10|^11|^12|^13
illuminate/bus Version ^10|^11|^12|^13