inmovilla-api-proxy
is a tool designed to solve a specific problem when interacting with the Inmovilla API: IP-based access restrictions.
Note: This project is not affiliated with, endorsed by, or maintained by Inmovilla.
Inmovilla restricts access to their API to specific IP addresses. This becomes a problem when you're developing from a machine outside the allowed IP range. Here's how the situation looks:
-
Production server with
inmovilla-api-client
installed
✅ Can connect to the Inmovilla API (IP is allowed). -
Development machine with
inmovilla-api-client
installed
❌ Cannot connect to the Inmovilla API (IP is not allowed).
This package solves the issue by enabling the production server to act as a proxy. With inmovilla-api-proxy
installed on the production server:
- Your development machine sends requests to the production server (acting as the proxy).
- The production server forwards these requests to the Inmovilla API.
- The response from the Inmovilla API is sent back to your development machine.
Here’s a visual representation of the interaction flow between the Development Server, Production Server, and the Inmovilla API:
inmovilla-api-client
is installed to send API requests to Inmovilla.inmovilla-api-proxy
is installed to act as a proxy for requests from the development machine.
inmovilla-api-client
is installed to send requests to the proxy on the production server.
-
Without Proxy
- Development server → Direct connection to Inmovilla API → ❌ IP not allowed.
-
With Proxy
- Development server → Proxy on production server → Inmovilla API → ✅ Works.
- PHP: 7.4 or higher.
- Composer: For dependency management.
- Libraries:
-
Install the Proxy on the Production Server Clone the repository or use Composer:
composer require inigo-aldama/inmovilla-api-proxy
-
Configure API Credentials Update the
api.ini
configuration file on both servers (development and production):api.ini
on the production server:api_url = "https://api.inmovilla.com/v1" domain = "production-domain.com" agency = "production-agency" password = "production-password" language = 1
api.ini
on the development server:api_url = "http://production-server-url/api-proxy" domain = "production-domain.com" agency = "development-agency" password = "development-password" language = 1
-
On the Production Server Deploy
inmovilla-api-proxy
with the following setup:<?php require 'vendor/autoload.php'; use Inmovilla\ApiClient\ApiClientConfig; use Inmovilla\Proxy\ProxyService; use GuzzleHttp\Client as GuzzleClient; use GuzzleHttp\Psr7\HttpFactory; $serverConfig = ApiClientConfig::fromIniFile(__DIR__ . '/config/api.ini'); $httpClient = new GuzzleClient(); $requestFactory = new HttpFactory(); $proxyService = new ProxyService($httpClient, $requestFactory, $serverConfig); $input = file_get_contents('php://input'); $response = $proxyService->handleRequest($input); header('Content-Type: application/json'); echo json_encode($response);
-
On the Development Machine Configure
api_url
to point to the production server's proxy, and useinmovilla-api-client
as usual.
- The proxy must be installed on the production server; it's not needed on the development machine.
- The
api.ini
configuration must exist on both servers:- The production server uses the real Inmovilla API URL.
- The development machine points
api_url
to the proxy URL.
When using the proxy, the following data is sent to Inmovilla:
api_url
: From the production server.domain
: From the production server.agency
: From the development machine.password
: From the development machine.language
: From the development machine.
Run PHPUnit tests to validate functionality:
./vendor/bin/phpunit --testdox
- Fork the repository.
- Create a new branch (
git checkout -b feature/new-feature
). - Commit your changes (
git commit -m 'Add new feature'
). - Push to your branch (
git push origin feature/new-feature
). - Open a pull request.
This project is licensed under the MIT License.
- Author: Iñigo Aldama Gómez
- Inmovilla API Client Repository: inmovilla-api-client