Search by

justimmo / php-sdk

Tschebel

PHP-SDK for the JUSTIMMO API

Package info

github.com/justimmo/php-sdk

pkg:composer/justimmo/php-sdk

Statistics

Installs: 49 948

Dependents: 1

Suggesters: 0

Stars: 6

Open Issues: 1

1.7.0 2026-11-09 16:21 UTC

README

CI Latest Version License Total Downloads

Installation

Composer (recommended)

$ composer require justimmo/php-sdk "~1.2"

The wide constraint is on purpose: Composer installs the newest version your PHP can run. 1.4 and later need PHP 8.1, so an older PHP gets an older 1.x instead of a failed install.

Composer generates a vendor/autoload.php file. You can simply include this file

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

If composer is not available you can set it up

$ curl -s https://getcomposer.org/installer | php

For more install options please refer to the Composer Documentation

manually

  • Download the latest stable release of php-sdk
  • Download https://github.com/php-fig/log
  • Extract php-sdk into your projects vendor folder
  • Extract log into the src folder of php-sdk
require_once 'path_to_extraction/src/autoload.php';

Documentation

Read the full documentation

Usage Example

<?php

use Justimmo\Api\JustimmoApi;
use Psr\Log\NullLogger;
use Justimmo\Model\RealtyQuery;
use Justimmo\Cache\NullCache;
use Justimmo\Model\Wrapper\V1\RealtyWrapper;
use Justimmo\Model\Mapper\V1\RealtyMapper;

$api = new JustimmoApi('username', 'password');
$mapper = new RealtyMapper();
$wrapper = new RealtyWrapper($mapper);
$query = new RealtyQuery($api, $wrapper, $mapper);
$realties = $query->filterByPrice(['min' => 500, 'max' => 1500])
    ->filterByZipCode('1020')
    ->orderByPrice('desc')
    ->find();

foreach ($realties as $realty) {
    echo $realty->getTitle() . ' ' . $realty->getPropertyNumber();
    //....
}

//fetching Realty by PrimaryKey
$query->findPk(12345);

Strict mode

The api ignores a filter it does not have, or a value it cannot take, and answers with an unfiltered list. A typo then looks like a working search. Since 1.5.0, strict mode rejects such a request with an exception instead of sending it. It is off by default:

$api->setStrict(true);     // every query built on this api
$query->strict();          // or one query

$query->filterByPrice(1000);                           // throws: the price filter only takes a range
$query->filterByPrice(['min' => 1000, 'max' => 1000]); // fine

In 2.0.0, strict mode is always on. What strict mode rejects today, 2.0.0 will reject too, so switching it on now shows what to change before the upgrade.

Since 1.6.0, a request which strict mode would reject emits a deprecation notice (E_USER_DEPRECATED) while strict mode is off, and is sent as before. Your error log then shows what to change, even without switching strict mode on.

Every exception the SDK throws for a call which fails, because the api does not answer, answers with an error status, or sends a body the SDK cannot read, implements Justimmo\Exception\JustimmoException. One catch (JustimmoException $e) catches them all.