Access Traffic Scotland's Current Incidents, Live Traffic Cameras, Unplanned Events, Roadworks, Future Roadworks, Traffic Status, Variable Message Signs and Journey Times.
A package for retrieving the latest traffic information in Scotland through Traffic Scotland.
Designed primarily for the Laravel & Lumen frameworks, you can easily just drop this into any PHP project using Composer.
- Package Features
- Minimum Viable Product
Installation using composer:
composer require adewra/traffic-scotland
For Lumen and Laravel versions earlier than
5.5 you'll also need to add the service provider in
This package is still in
Pre-release, upgrade instructions will come when the first update is officially released.
To publish the configuration file run:
> php artisan vendor:publish --tag=config --tag=migrations --tag=seeds
This will copy the configuration file to
Here is an example (and the default) configuration:
'functionality' => [ 'incidents' => true, 'roadworks' => [ 'current' => true, 'planned' => true, ], 'events' => true, ], 'collection_methods' => [ 'api' => true, 'rss_feeds' => false, 'webpage_scraping' => false, ], 'storage' => true
To run our database migrations that allow for storing of the data:
php artisan migrate --path=/packages/adewra/trafficscotland/src/migrations
Troubleshooting hasn't been written yet.
- Roadworks (Current & Planned)
- Events (& Venues)
- Traffic Cameras
- Park and Ride
- Weather Incidents
- Weather Stations
- Police Travel Warnings
- Variable Message Signs
- Highways England
The preferred method for obtaining information is through Traffic Scotland's API that is utilised by the mobile version of their website.
Alternative methods include use of Datex II Service, RSS Feeds or through scraping the web pages.
Retrieving Current Incidents
$incidents = TrafficScotland::incidents();
php artisan trafficscotland:incidents
php artisan tinker >>> Adewra\TrafficScotland\Incident::all();
$roadworks = TrafficScotland::roadworks(true, true);
php artisan trafficscotland:roadworks
php artisan tinker >>> Adewra\TrafficScotland\Roadwork::all();
$roadworks = TrafficScotland::events();
php artisan trafficscotland:events
php artisan tinker >>> Adewra\TrafficScotland\Event::all(); >>> Adewra\TrafficScotland\Venue::all();