Downloads
Stars
Version
You will need to request a client_id
and a client_secret
at velo-antwerpen.be to actually use this package.
You can install the package via composer:
composer require earnould/laravel-velo-api
The package will automatically register itself.
You'll need to publish the config file with:
php artisan vendor:publish --provider="Earnould\LaravelVeloApi\VeloServiceProvider" --tag="config"
This allows you to define the client id and secret in your .env file like this:
VELO_CLIENT_ID = ''
VELO_CLIENT_SECRET = ''
This package allows you to connect to the Velo Antwerp API. For now there are only two sources available stations
and stationsStatuses
. The stations resource speaks for itself. The stationsStatuses resource returns the availability of all stations. The API requires a client_id and client_secret to fetch these results.
A quick overview:
You can retrieve all Velo station resources using the Earnould\LaravelVeloApi\Facades\VeloStations
facade.
Retrieves all Velo stations in Antwerp
VeloStations::all();
Returns:
Collection {
array [
0 => Earnould\LaravelVeloApi\Station {
[
"id" => "036"
"name" => "036- Bourla"
"address" => "Schuttershofstraat n° 2"
"addressNumber" => null
"zipCode" => "2000"
"districtCode" => null
"districtName" => null
"altitude" => null
"location" => array:2 [
"lat" => "51.2163878210059"
"lon" => "4.40593043087013"
]
"stationType" => "BIKE"
]
}
... => Earnould\LaravelVeloApi\Station {...}
Requests all Velo stations with their corresponding status
VeloStations::allWithStatuses();
Returns:
Collection {
[
0 => Earnould\LaravelVeloApi\Station {
[
"id" => "036"
"name" => "036- Bourla"
"address" => "Schuttershofstraat n° 2"
"addressNumber" => null
"zipCode" => "2000"
"districtCode" => null
"districtName" => null
"altitude" => null
"location" => [
"lat" => "51.2163878210059",
"lon" => "4.40593043087013"
]
"stationType" => "BIKE"
"status" => "OPN"
"availability" => [
"bikes" => 19,
"slots" => 1
]
]
... => Earnould\LaravelVeloApi\Station {...}
]
}
NOTE: The status will be OPN
for open stations and CLS
for Closed stations.
Any bugs? Any suggestions or question? Shoot an issue on GitHub and let's have a look.
If you've found a security issue please mail [email protected] instead of using the issue tracker.
Please see CHANGELOG for more information about recent changes.
vendor/bin/phpunit
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.