1. Go to this page and download the library: Download homlity/sdk-metrocuadrado library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
homlity / sdk-metrocuadrado example snippets
use Metrocuadrado\Sdk\Auth\Credentials;
use Metrocuadrado\Sdk\Config;
use Metrocuadrado\Sdk\MetrocuadradoClient;
$config = Config::production(
apiKey: getenv('METROCUADRADO_API_KEY'),
credentials: new Credentials(
username: getenv('METROCUADRADO_USERNAME'),
password: getenv('METROCUADRADO_PASSWORD'),
identification: getenv('METROCUADRADO_IDENTIFICATION'),
),
);
$client = new MetrocuadradoClient($config);
// Catálogos (sólo API key)
$regions = $client->catalogue()->regions();
$cities = $client->catalogue()->cities(regionId: 1);
$types = $client->catalogue()->realEstateTypes();
// Inmuebles (API key + JWT, que el SDK obtiene y renueva solo)
$receipt = $client->realEstate()->publish($property);
$estado = $client->transactions()->find($receipt->transactionId());
$client->realEstate()->published();
$client->realEstate()->unpublish('11222-M4137000', 'https://tu-dominio.com/callback');
// Agentes y sucursales
$client->agents()->create($agent);
$client->offices()->all();
$client->realEstate()->publish(['price' => 1]);
// InvalidArgumentException: Real estate publication: missing
$client = new MetrocuadradoClient($config, $fakeHttpClient, $schemaCatalog, $fakeTokenProvider);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.