amattu2/vinwiki-wrapper

A VINwiki.com API wrapper. Opens up access to VINWiki API functionality; Fetch feeds by a VIN, use plate2vin (pl82vin), add a new event to a feed, etc.

v1.0.5 2024-09-21 19:09 UTC

This package is auto-updated.

Last update: 2024-12-21 19:53:01 UTC


README

This is an unofficial and dependency-free VINwiki.com API wrapper written PHP. It offers a simple interface for interacting with the VINwiki API. Among other things, it allows you to:

  • Read and update user profiles
  • Read and update vehicle information
  • Read, create, and delete posts
  • Decode license plates by country and state
  • Search for vehicles by VIN, Year, Make, Model, or free-text

Usage

Installation

Via Composer

composer require amattu2/vinwiki-wrapper

Then, require Composer's autoloader:

require 'vendor/autoload.php';

Instantiate the class:

$wrapper = new amattu2\VINwiki\Client("email|username", "password");

Functions

People

These functions relate to person interactions.

getPersonProfile(string $uuid = "") : ?VINwiki\Models\Person

Returns a VINwiki user profile. If no user is specified, the current user's profile is returned.

// for the current user
print_r($wrapper->getPersonProfile());

// or for a specific user
print_r($wrapper->getPersonProfile("61382da4-25c6-494f-8065-87afdfb4f50d"));
updatePersonProfile(string $uuid, VINwiki\Models\Person $person): ?VINwiki\Models\Person

Updates the current user's profile. Returns the updated profile on success. The only required field is "email".

See Models\Person for more fields.

$person = new amattu2\VINwiki\Models\Person([
  "email" => "abc123@example.com",
]);
print_r($wrapper->updatePersonProfile("{UUID GOES HERE}", $person));
getPersonNotifications() : ?array

Get the current user's notifications.

print_r($wrapper->getPersonNotifications());
getPersonFeed(string $uuid = "", bool $filterFollowing = true): ?Models\PersonFeed

Get a user's post feed. If no $uuid is specified, the current user's feed is returned. If $filterFollowing is true, only the posts for vehicles/people that the specified user is following will be returned.

// for the current user
print_r($wrapper->getPersonFeed());

// or for a specific user
print_r($wrapper->getPersonFeed("61382da4-25c6-494f-8065-87afdfb4f50d", false));
getPersonPosts(string $uuid = ""): ?VINwiki\Models\PersonPosts

Get a user's posts. If no user is specified, the current user's posts are returned.

// for the current user
print_r($wrapper->getPersonPosts());

// or for a specific user
print_r($wrapper->getPersonPosts("61382da4-25c6-494f-8065-87afdfb4f50d"));
getRecentVins(): ?VINwiki\Models\RecentVins

Returns a list of vehicles the user has recently posted on or interacted with. Does not include vehicles that the user has only viewed.

print_r($wrapper->getRecentVins());

Vehicles

These functions handle any vehicle-related interactions.

plateLookup(string $plate, string $country, string $state): ?VINwiki\Models\PlateLookup

Returns a vehicle decoded by the license plate. Currently supports US/UK plates.

print_r($wrapper->plateLookup("HELLO", "US", "CA"));
getFeed(string $vin): ?VINwiki\Models\VehicleFeed

Get a vehicle's post feed (i.e. when you visit a vehicle's page on VINwiki.com)

print_r($wrapper->getFeed("WBAPL33579A406957"));
getVehicle(string $vin): ?VINwiki\Models\Vehicle

Get a vehicle's information by VIN.

print_r($wrapper->getVehicle("WBAPL33579A406957"));
vehicleSearch(string $query): ?VINwiki\Models\VehicleSearch

Perform a free-text search for vehicles by Year, Make, Model, or VIN.

print_r($wrapper->vehicleSearch("2011 Toyota Corolla"));
updateVehicle(string $vin, int $year, string $make, string $model, string $trim = ""): bool

Update a vehicle's Year, Make, Model, and Trim by VIN. Returns true if successful.

print_r($wrapper->updateVehicle("WBAPL33579A406957", 2009, "BMW", "335i", "xDrive"));
createPost(string $vin, VINwiki\Models\VehiclePost $post): ?VINwiki\Models\FeedPost

Create a new post on a vehicle. Requires a VIN and a VehiclePost object. Returns the new post on success.

See Models\VehiclePost for more information.

// Create a new post class
$post = new amattu2\VINwiki\Models\VehiclePost([
  "mileage" => 43000,
  "text" => "This is a test post from the VINwiki-Wrapper PHP library.",
]);

// Post it
print_r($wrapper->createPost("WBAPL33579A406957", $post));
deletePost(string $uuid) : bool

Delete a post by UUID. Returns true if successful. Requires the user to be the author of the post.

print_r($wrapper->deletePost("61382da4-25c6-494f-8065-87afdfb4f50d"));

Requirements

  • PHP 7.4+
  • cURL
  • Composer (Preferred)