Package Data | |
---|---|
Maintainer Username: | joshtimitek |
Maintainer Contact: | support@timitek.com (timitek, llc) |
Package Create Date: | 2017-01-18 |
Package Last Update: | 2023-02-20 |
Language: | Blade |
License: | MIT |
Last Refreshed: | 2024-11-19 03:09:42 |
Package Statistics | |
---|---|
Total Downloads: | 115 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 4 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
# getrets-laravel
A laravel package for the GetRETS® API from timitek (http://www.timitek.com).
Based on the PHP SDK found at (https://github.com/timitek/getrets-php-sdk).
GetRETS® is a product / service developed by timitek that makes it possible to quickly build real estate related applications for pulling listing data from several MLS's without having to know anything about RETS or IDX or worry about the pains of mapping and storing listing data from these various sources.
GetRETS® as a service provides a RESTful API endpoint for consuming the data, and although it's not limited to only being used in PHP applications, and users aren't required to use our SDK, we have provided a simple PHP SDK for the API and set of documentation for it's use.
| Laravel Version | Package Tag | |-----------------|-------------| | 5.5.x | 1.1.x | | 5.4.x | 1.0.x |
To add to an existing Laravel application run the following command.
composer require timitek/getrets-laravel
Note: For Laravel 5.4 and older it is necessary to add the following to the providers section within config/app.php.
Timitek\GetRETS\Providers\GetRETSServiceProvider::class,
Publish the config file to config/getrets.php with the following command.
php artisan vendor:publish --provider="Timitek\GetRETS\Providers\GetRETSServiceProvider" --tag=config
You may now add the customer key provided to you by timitek.com by either modifying the config/getrets.php or by adding the following to your .env file.
GETRETS_CUSTOMER_KEY=your_customer_key_from_timitek
A sample controller and view have been provided to help you get started.
To test the installation enable the examples, start the project, and browse to /getrets/example.
To enable the sampe code set the GETRETS_ENABLE_EXAMPLE to true in your .env file.
GETRETS_ENABLE_EXAMPLE=true
Serve the application on the PHP development server by running;
php artisan serve
View the project examples by browsing too
http://localhost:8000/getrets/example
To disable the sampe code set the GETRETS_ENABLE_EXAMPLE to false in your .env file.
GETRETS_ENABLE_EXAMPLE=false
The main controller for working with the listings using the pre-fetched / cached data.
GetRETS::getListing();
This is the main entry point for retrieving cached listings. Using this entry point will pull listing data that has been pre-fetched from your MLS.
Advantages
Disadvantages
Search for listings by keyword
GetRETS::getListing()->searchByKeyword($preparedKeywords);
A simple search that will retrieve listings by a keyword search.
keyword - Keywords to search on
An array of CondensedListing's
[
{
"id": "string",
"listingSourceURLSlug": "string",
"listingTypeURLSlug": "string",
"listingID": "string",
"listingSource": 1,
"listingType": 1,
"address": "string",
"baths": 0,
"beds": 0,
"listPrice": "string",
"rawListPrice": 0,
"providedBy": "string",
"squareFeet": 0,
"lot": "string",
"acres": "string"
}
]
Advanced search
GetRETS::getListing()->search($keywords, $extra, $maxPrice, $minPrice, $beds, $baths, $includeResidential, $includeLand, $includeCommercial);
A more advanced search that retrieves listings constrained by the optional parameters.
keyword - Keywords to search on
extra - (optional) Comma seperated list of extra terms to search for (golf, lake, etc...)
maxPrice - (optional) The maximum listing price
minPrice - (optional) The minimum listing price
beds - (optional) The minimum number of beds to require
baths - (optional) The minimum number of baths to require
includeResidential - (optional) Include residential listings
includeLand - (optional) Include land listings
includeCommercial - (optional) Include commercial listings
Note - If you don't set any of the include parameters, all will be assumed as set.
An array of CondensedListing's
[
{
"id": "string",
"listingSourceURLSlug": "string",
"listingTypeURLSlug": "string",
"listingID": "string",
"listingSource": 1,
"listingType": 1,
"address": "string",
"baths": 0,
"beds": 0,
"listPrice": "string",
"rawListPrice": 0,
"providedBy": "string",
"squareFeet": 0,
"lot": "string",
"acres": "string"
}
]
Get details for a specific listing
GetRETS::getListing()->details($listingSource, $listingType, $listingId);
Retrieves the more specific / non condensed details for a listing. You will typically use the values returned from search functions as the parameters.
listingSource - A string representation of the MLS listing source (see FeedsModels.Models.enumListingSource)
listingType - A string representation of the listing type such as residential, land etc.. (see FeedsModels.Models.enumListingType)
listingId - The unique ID for the listing to retrieve the listing for
A single Listing
{
"description": "string",
"features": [
"string"
],
"photoCount": 0,
"id": "string",
"listingSourceURLSlug": "string",
"listingTypeURLSlug": "string",
"listingID": "string",
"listingSource": 1,
"listingType": 1,
"address": "string",
"baths": 0,
"beds": 0,
"listPrice": "string",
"rawListPrice": 0,
"providedBy": "string",
"squareFeet": 0,
"lot": "string",
"acres": "string"
}
Get URL to use for displaying an image
GetRETS::getListing()->imageUrl($listingSource, $listingType, $listingId, $photoId, $width = null, $height = null);
Retrieves an image(s) associated with a specific listing.
Special Note - While the width and height parameters are optional, using them to specify an appropriate image size will increase the speed in which your site renders by lowering the need to download a full size image.
Also, fetching the first photo ($photoId = 0) is a suggested strategy for displaying a thumbnail image.
listingSource - A string representation of the MLS listing source (see FeedsModels.Models.enumListingSource)
listingType - A string representation of the listing type such as residential, land etc.. (see FeedsModels.Models.enumListingType)
listingId - The unique ID for the listing to retrieve the listing for
photoId - A zero based index for the photo to retrieve (see the photoCount that is returned in the listing details).
width - The width to be used for resizing the photo
height - The height to be used for resizing the photo
A URL for the image specified
The main controller for working with the listings using the the live data contained at the MLS using RETS.
GetRETS::getRETSListing();
This is the main entry point for retrieving live listing data from the MLS via RETS.
Advantages
Disadvantages
Special Note - All of the same functions used for fetching data from the cached data (see listing controller functions above) are applicable to this API controller as well, as the exist with the same signatures, only they will go directly to the RETS server.
Search for listings by keyword
GetRETS::getRETSListing()->searchByKeyword($preparedKeywords);
A simple search that will retrieve listings by a keyword search.
keyword - Keywords to search on
An array of CondensedListing's
[
{
"id": "string",
"listingSourceURLSlug": "string",
"listingTypeURLSlug": "string",
"listingID": "string",
"listingSource": 1,
"listingType": 1,
"address": "string",
"baths": 0,
"beds": 0,
"listPrice": "string",
"rawListPrice": 0,
"providedBy": "string",
"squareFeet": 0,
"lot": "string",
"acres": "string"
}
]
Advanced search
GetRETS::getRETSListing()->search($keywords, $extra, $maxPrice, $minPrice, $beds, $baths, $includeResidential, $includeLand, $includeCommercial);
A more advanced search that retrieves listings constrained by the optional parameters.
keyword - Keywords to search on
extra - (optional) Comma seperated list of extra terms to search for (golf, lake, etc...)
maxPrice - (optional) The maximum listing price
minPrice - (optional) The minimum listing price
beds - (optional) The minimum number of beds to require
baths - (optional) The minimum number of baths to require
includeResidential - (optional) Include residential listings
includeLand - (optional) Include land listings
includeCommercial - (optional) Include commercial listings
Note - If you don't set any of the include parameters, all will be assumed as set.
An array of CondensedListing's
[
{
"id": "string",
"listingSourceURLSlug": "string",
"listingTypeURLSlug": "string",
"listingID": "string",
"listingSource": 1,
"listingType": 1,
"address": "string",
"baths": 0,
"beds": 0,
"listPrice": "string",
"rawListPrice": 0,
"providedBy": "string",
"squareFeet": 0,
"lot": "string",
"acres": "string"
}
]
Get details for a specific listing
GetRETS::getRETSListing()->details($listingSource, $listingType, $listingId);
Retrieves the more specific / non condensed details for a listing. You will typically use the values returned from search functions as the parameters.
listingSource - A string representation of the MLS listing source (see FeedsModels.Models.enumListingSource)
listingType - A string representation of the listing type such as residential, land etc.. (see FeedsModels.Models.enumListingType)
listingId - The unique ID for the listing to retrieve the listing for
A single Listing
{
"description": "string",
"features": [
"string"
],
"photoCount": 0,
"id": "string",
"listingSourceURLSlug": "string",
"listingTypeURLSlug": "string",
"listingID": "string",
"listingSource": 1,
"listingType": 1,
"address": "string",
"baths": 0,
"beds": 0,
"listPrice": "string",
"rawListPrice": 0,
"providedBy": "string",
"squareFeet": 0,
"lot": "string",
"acres": "string"
}
Get URL to use for displaying an image
GetRETS::getRETSListing()->imageUrl($listingSource, $listingType, $listingId, $photoId, $width = null, $height = null);
Retrieves an image(s) associated with a specific listing.
Special Note - While the width and height parameters are optional, using them to specify an appropriate image size will increase the speed in which your site renders by lowering the need to download a full size image.
Also, fetching the first photo ($photoId = 0) is a suggested strategy for displaying a thumbnail image.
listingSource - A string representation of the MLS listing source (see FeedsModels.Models.enumListingSource)
listingType - A string representation of the listing type such as residential, land etc.. (see FeedsModels.Models.enumListingType)
listingId - The unique ID for the listing to retrieve the listing for
photoId - A zero based index for the photo to retrieve (see the photoCount that is returned in the listing details).
width - The width to be used for resizing the photo
height - The height to be used for resizing the photo
A URL for the image specified
Return MLS results via a DMQL query
GetRETS::getRETSListing()->executeDMQL($query, $feedName, $listingType);
This is a powerful function that will execute raw DMQL against the RETS MLS server and will return the results as a serialized object.
Special Note - These results will not be returned in a translated fashion similiar to the other listing detail searches. These results are in the format as returned from the MLS RETS server. If you wish to retrieve listings in a translated format use getListingsByDMQL.
query - The DMQL to be executed against the MLS RETS server
feedName - The name of the feed to run the query against
listingType - A string representation of the listing type such as residential, land etc.. (see FeedsModels.Models.enumListingType)
An enveloped response with the success or failure of the query, as well as the raw serialized results that were fetched. These serialized results will be different for each feedName and listingType.
{
"success": true,
"code": 0,
"message": "string",
"data": [
{
"className": "string"
}
]
}
Get translated listings by DMQL query
GetRETS::getRETSListing()->getListingsByDMQL($query, $feedName, $listingType);
This is a powerful function that will execute raw DMQL against the RETS MLS server and will return the results as a serialized object. It is similar to executeDMQL, however this function will translate data to be in the same format as returned by other methods that retrieve listing details.
query - The DMQL to be executed against the MLS RETS server
feedName - The name of the feed to run the query against
listingType - A string representation of the listing type such as residential, land etc.. (see FeedsModels.Models.enumListingType)
An enveloped response with the success or failure of the query, as well as the raw serialized results that were fetched.
{
"success": true,
"code": 0,
"message": "string",
"data": [
{
"description": "string",
"features": [
"string"
],
"photoCount": 0,
"id": "string",
"listingSourceURLSlug": "string",
"listingTypeURLSlug": "string",
"listingID": "string",
"listingSource": 1,
"listingType": 1,
"address": "string",
"baths": 0,
"beds": 0,
"listPrice": "string",
"rawListPrice": 0,
"providedBy": "string",
"squareFeet": 0,
"lot": "string",
"acres": "string"
}
]
}
The main controller for working with addresses
GetRETS::getGeocoding();
This controller is a planned area of growth to provide more advanced geo-spatial style searching for listing data. For the time being, it is used for parsing keywords into more geocoded data to be used for searching.
If you provide a google geocode key to be associated with your account, you can use these methods.
Translates results returned by Google
GetRETS::getGeocoding()->parseGoogleResults($googleResults);
This function will parse the results returned from Google's service and translate them into a consistent format more suitable for searching the listing data.
googleResults - Results from Google's geocoder.geocode
[
{
"address_components": [
{
"long_name": "string",
"short_name": "string",
"types": [
"string"
]
}
],
"formatted_address": "string",
"geometry": {
"bounds": {
"south": 0,
"west": 0,
"north": 0,
"east": 0
},
"location": {
"lat": 0,
"lng": 0
},
"location_type": "string",
"viewport": {
"south": 0,
"west": 0,
"north": 0,
"east": 0
}
},
"place_id": "string",
"types": [
"string"
]
}
]
Data translated as AddressDetail's.
[
{
"streetNumber": "string",
"street": "string",
"city": "string",
"county": "string",
"state": "string",
"stateAbbreviation": "string",
"country": "string",
"postalCode": "string",
"latitude": 0,
"longitude": 0,
"formattedAddress": "string"
}
]
Geocode address entered as free-form text
GetRETS::getGeocoding()->googleGeocode($address);
This function will take a keyword and run it through Google's geocoding service and return the translated results.
address - A free form text to geocode (The expectation is that this is a possible address)
Data translated as AddressDetail's.
[
{
"streetNumber": "string",
"street": "string",
"city": "string",
"county": "string",
"state": "string",
"stateAbbreviation": "string",
"country": "string",
"postalCode": "string",
"latitude": 0,
"longitude": 0,
"formattedAddress": "string"
}
]
The following methods aren't API endpoints but are available in the SDK for assistance with the functionality.
Used for sorting / ordering the results that are returned
GetRETS::getListing()->setSortBy("providedBy")->setReverseSort(true)->searchByKeyword($preparedKeywords);
setSortBy
This property is used to set column by which the data is sorted.
setReverseSort
This property is used to set the order (ascending / descending) by which the sortBy column will ordered by. (Default is false meaning ascending)
By default listings will be sorted by the price from low to high. If you want to change the defaults, you can modify these lines.
private $sortBy = "rawListPrice";
private $reverseSort = false;
If you want to sort listings manually within any other portion of the app, you can use the setSortBy and setReverseSort methods as in the following syntax.
$listings = $getRets->getListing()->setSortBy("providedBy")->setReverseSort(true)->searchByKeyword($preparedKeywords);
More information on the API itself can be found at the Swagger UI (http://getrets.net/swagger/).