Download the PHP package neighborhoods/phrets without Composer
On this page you can find all versions of the php package neighborhoods/phrets. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download neighborhoods/phrets
More information about neighborhoods/phrets
Files in neighborhoods/phrets
Package phrets
Short Description RETS library in PHP
License MIT
Homepage http://github.com/neighborhoods/PHRETS
Informations about the package phrets
Note: If you're looking for version 1, please see the "1.x" branch. Otherwise, it's highly recommended that you use version 2+.
PHRETS
PHP client library for interacting with a RETS server to pull real estate listings, photos and other data made available from an MLS system
Introduction
PHRETS provides PHP developers a way to integrate RETS functionality directly within new or existing code by handling the following aspects for you:
- Response parsing (XML, HTTP multipart, etc.)
- Simple variables, arrays and objects returned to the developer
- RETS communication (over HTTP)
- HTTP Header management
- Authentication
- Session/Cookie management
- PHP 5.6, 7.0, 7.1 and 7.2 supported
Installation
The easiest way to get started is using Composer to install troydavisson/phrets:
Get Help
The best place to ask for help is either our Slack channel or in our Google Group. Please leave GitHub's issue tracker for bugs with the library.
Disclaimer
In many cases, the capabilities provided by this library are dependent on these features being properly implemented by the RETS server you're accessing. The RETS specification defines how clients and servers communicate, and if a server is doing something unexpected, this library may not work without tweaking some options.
Documentation
Configuration
The first step with getting connected to a RETS server is to configure the connection.
Available options are:
use_post_method
- Always use HTTP POST instead of HTTP GET. Default isfalse
(uses GET)disable_follow_location
- Disable the ability to automatically handle redirects sent by the server. Default isfalse
(follow redirects)
As an alternative, you can also load configuration options from an array:
Connecting
Once the configuration has been setup, a RETS session can be started:
Login
This will make the first request to the RETS server. In addition to general authentication, this step is required to finalize the session's configuration. Within the Login response, RETS servers provide back information needed for all other requests, so this has to be done first.
Grabbing Records
Note: In order to grab records from a RETS server, you need to first know the types of information you're allowed to get and see. This information is provided through the metadata calls supported by a RETS server, but using a RETS metadata viewer service such as RETSMD.com can make this process much faster unless you have a specific need for having parseable metadata.
With a known RETS Resource, Class and DMQL query, you can issue requests for records:
Processing Results
The result of a $rets->Search()
request will return a \PHRETS\Models\Search\Results
object which can be used, in many ways, like a regular array. Each item in that array is a \PHRETS\Models\Search\Record
object representing a single record returned.
$results can be used in a foreach loop like above, but some additional helper methods exist:
Because each $record is an object, some helper methods exist:
Downloading Media (Photos, Images, Documents, etc.)
The returned value from a $rets->GetObject()
call is a \Illuminate\Support\Collection
object which allows many common array-like features as well as some helper methods.
Each object within that collection is a \PHRETS\Models\BaseObject
object with it's own set of helper methods:
All versions of phrets with dependencies
guzzlehttp/guzzle Version >=6.0
illuminate/container Version >=4.2.0
illuminate/support Version >=4.2.0
league/csv Version >=6.0