2017 © Pedro Peláez
 

library sturents-api

image

zhan3333/sturents-api

  • Wednesday, February 21, 2018
  • by zhan3333
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

StuRents API Helper

Install using composer:, (*1)

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., (*2)

  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:, (*3)

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., (*4)

Send a property to StuRents

$data = [
    ... // see https://sturents.com/software/developer/house-create
];
$create_house = new \Sturents\Api\CreateOrUpdateHouse(LANDLORD_ID, API_KEY);
$create_house->setJson($data);
try {
    $create_house->send();
}
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 {
    $fetch_houses->fetchAll();
    $properties = $fetch_houses->getProperties();
}
catch (\Exception $e){
   echo "A problem happened: ".$e->getMessage();
}

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

The Versions

21/02 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

11/08 2017

1.2.1

1.2.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

11/08 2017

1.2.0

1.2.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

23/12 2016

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

01/12 2016

0.3.0

0.3.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

08/09 2016

0.2.2

0.2.2.0

  Sources   Download

MIT

The Requires

 

The Development Requires

21/03 2016

0.2.1

0.2.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

02/03 2016

0.2.0

0.2.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

10/02 2016

0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires