LaravelPackages.net
Acme Inc.
Toggle sidebar
earnould/laravel-velo-api

laravel-velo-api is a package that allows you to connect to the Velo Antwerp API. The Velo Antwerp API is..

7
1
1.1.0
About earnould/laravel-velo-api

earnould/laravel-velo-api is a Laravel package for laravel-velo-api is a package that allows you to connect to the velo antwerp api. the velo antwerp api is... It currently has 1 GitHub stars and 7 downloads on Packagist (latest version 1.1.0). Install it with composer require earnould/laravel-velo-api. Discover more Laravel packages by earnould or browse all Laravel packages to compare alternatives.

Last updated

Pull Velo API resources in your Laravel app

Latest Version on Packagist Code coverage Quality Score StyleCI


NOTE

You will need to request a client_id and a client_secret at velo-antwerpen.be to actually use this package.


Installation

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.


Documentation

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.

Changelog

Please see CHANGELOG for more information about recent changes.

Testing

vendor/bin/phpunit

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Star History Chart