1.2.1 2017-08-11 12:56 UTC

This package is auto-updated.

Last update: 2023-01-14 16:43:32 UTC


Install using composer:

php composer.phar require sturents/api

Wait, what's Composer?

Composer is the de-facto package manager for PHP projects. If you haven't used it before it is very simple to set up.

  1. Visit the Composer download page and follow instructions to download composer into your project root.
  2. You should now have a file called composer.phar in your project root. You can run various commands using this file.
  3. Start by running php composer.phar init to create your composer.json file. This file stores all your project configuration and dependencies.
  4. Now either run the command at the top of the readme to install the StuRents API, or add "sturents/api": "*" to the "require" object inside your composer.json file.

To use Composer dependencies inside a PHP file is simple - just the following to the top of your file:

require_once __DIR__.'/vendor/autoload.php';

Now you can create or use any object without having to worry about requiring its files - Composer and PHP's autoloader will handle that for you.

Send a property to StuRents

$data = [
    ... // see https://sturents.com/software/developer/house-create
$create_house = new \Sturents\Api\CreateOrUpdateHouse(LANDLORD_ID, API_KEY);
try {
catch (\Exception $e){
   echo "A problem happened: ".$e->getMessage();

var_dump($create_house->responseJson()->isSuccess()); // true if request succeeded

$affected_id = $create_house->responseAffectedProperty(); // outputs an integer

Fetch data from StuRents

$fetch_houses = new \Sturents\Api\FetchHouses(LANDLORD_ID, PUBLIC_KEY);
try {
    $properties = $fetch_houses->getProperties();
catch (\Exception $e){
   echo "A problem happened: ".$e->getMessage();

echo count($properties) // echo, e.g. 1