Download the PHP package sturents/api without Composer

On this page you can find all versions of the php package sturents/api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package api

StuRents API Helper

Master branch is for v2.0 which is not available yet; please check releases for previous versions. For outbound data check 1.3., for inbound use 1.2.

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

$property = new \SturentsLib\Api\Models\PropertyCreation;
// Use setters to create sub-objects and set properties as
// described in the documentation:
//   https://sturents.com/software/developer/house-create
// Or as demonstrated in `examples/send.php`

$upload_client = new \SturentsLib\Api\UploadClient(LANDLORD_ID, UPLOAD_KEY);
$put_property = new \SturentsLib\Api\Requests\PutProperty;
$put_property->setBody($property);
try {
    $response = $put_property->sendWith($upload_client);
}
catch (\Exception $e){
   echo "An unexpected problem happened: ".$e->getMessage();
}

if ($response instanceof PropertySaved){
    echo 'Property created with ID: '.$response->getPropertyId()."\n"; // outputs an integer
}
elseif ($response->isError()){
    echo 'A known error occurred of type '.get_class($response)."\n";
    echo json_encode($response)."\n";
}
else {
    echo 'An unknown error occurred of type '.get_class($response)."\n";
}

Fetch data from StuRents with a Landlord ID

// Where LANDLORD_ID is an integer
$display_client = new \SturentsLib\Api\DisplayClient(LANDLORD_ID, DISPLAY_KEY);
$get_properties = new \SturentsLib\Api\Requests\GetProperties;
try {
    $response = $get_properties->sendWith($display_client);
}
catch (\Exception $e){
   echo "A problem happened: ".$e->getMessage();
}

var_dump($response instanceof ListProperties); // outputs 'true'

echo $response->pagination->pages // echo, e.g. 3

var_dump($response->properties[0] instanceof PropertyOutbound) // outputs 'true'

Fetch data from StuRents as a channel

// Where *_ID values are strings
$display_client = new \SturentsLib\Api\ChannelClient(LANDLORD_ID, CHANNEL_ID, DISPLAY_KEY);
$get_properties = new \SturentsLib\Api\Requests\GetProperties;
try {
    $response = $get_properties->sendWith($display_client);
}
catch (\Exception $e){
   echo "A problem happened: ".$e->getMessage();
}

var_dump($response instanceof ListProperties); // outputs 'true'

echo $response->pagination->pages // echo, e.g. 3

var_dump($response->properties[0] instanceof PropertyOutbound) // outputs 'true'

All versions of api with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
guzzlehttp/guzzle Version ^6.0 || ^7.0
netresearch/jsonmapper Version ^1.4 || ^2.0 || ^3.0 || ^4.0
psr/http-message Version ^1.1 || ^2.0
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sturents/api contains the following files

Loading the files please wait ....