PHPackages                             com-company/php-ubiflow-api-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. com-company/php-ubiflow-api-client

ActiveLibrary[API Development](/categories/api)

com-company/php-ubiflow-api-client
==================================

Api client permettant d'utiliser les Api d'Ubiflow pour publier une annonce ou récupérer des contacts

1.0.1(7mo ago)11.1k↑60%AGPL-3.0-or-laterPHPPHP &gt;=8.3CI passing

Since Sep 29Pushed 7mo agoCompare

[ Source](https://github.com/Com-Company/php-ubiflow-api-client)[ Packagist](https://packagist.org/packages/com-company/php-ubiflow-api-client)[ Docs](https://github.com/com-company/php-ubiflow-api-client)[ RSS](/packages/com-company-php-ubiflow-api-client/feed)WikiDiscussions main Synced 2mo ago

READMEChangelog (2)Dependencies (10)Versions (3)Used By (0)

[![License: AGPL v3](https://camo.githubusercontent.com/0fb4f7634808706feb5d9bf669e078e2da524534575a39f2f08c74de3d8a1135/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4147504c2d2d332e302d626c75652e737667)](https://www.gnu.org/licenses/agpl-3.0.html)[![PHP Version](https://camo.githubusercontent.com/83d697baa78e4225d630587096ed1b0d8a0ece94e9b2ebab599fc9bb986477ac/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332b2d626c75652e737667)](https://www.php.net/releases/8.3/)[![Packagist](https://camo.githubusercontent.com/6b5b4c2843eb7b8e8df03e65e3369c11236005340949dfc2c55d17d9833a0b81/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6d2d636f6d70616e792f7068702d756269666c6f772d6170692d636c69656e742e737667)](https://packagist.org/packages/com-company/php-ubiflow-api-client)[![Tests](https://github.com/com-company/php-ubiflow-api-client/actions/workflows/tests.yml/badge.svg)](https://github.com/com-company/php-ubiflow-api-client/actions/workflows/tests.yml/badge.svg)

### Client PHP pour l’API Ubiflow

[](#client-php-pour-lapi-ubiflow)

Ce client PHP permet d'interagir facilement avec les API Ubiflow pour publier des annonces immobilières ou automobiles, récupérer les contacts générés via les portails, et gérer la diffusion des annonces sur différents supports partenaires.

Il s'adresse aux développeurs ou intégrateurs souhaitant intégrer les fonctionnalités d'Ubiflow dans un projet PHP (Symfony, Laravel, ou autre).

### Sommaire

[](#sommaire)

1. [Pré-requis](#1-pr%C3%A9requis)
2. [Installation du package](#2-installation-du-package)
3. [Utilisation de l’API pour publier une annonce](#3-utilisation-de-lapi-pour-publier-une-annonce)
4. [Utilisation de l’API pour récupérer des contacts](#4-utilisation-de-lapi-pour-r%C3%A9cup%C3%A9rer-des-contacts)
5. [Licence](#-licence)

### 1) Prérequis

[](#1-prérequis)

- PHP &gt;= 8.3
- 3 dépendances PHP, automatiquement installées par Composer :
    - psr/cache
    - symfony/http-client-contracts
    - thecodingmachine/safe

### 2) Installation du package

[](#2-installation-du-package)

#### Installation via Composer

[](#installation-via-composer)

```
composer require com-company/php-ubiflow-api-client
```

#### Configuration du package

[](#configuration-du-package)

Le client `ComCompany\PhpUbiflowApiClient\Client` nécessite plusieurs paramètres :

- `$httpClient` : un service qui implémente l’interface `Symfony\Contracts\HttpClient\HttpClientInterface`.
- `$ubiflowClientId` : l’identifiant Ubiflow, composé de chiffres.
- `$ubiflowClientCode` : le code Ubiflow, généralement l’identifiant précédé de `ag`, par exemple `agxxxxxx`.
- `$ubiflowClientLogin` : le login utilisé pour les API, généralement identique au `$ubiflowClientCode` et à l’accès au portail web.
- `$ubiflowClientSecret` : le mot de passe pour les API.
- `$cachePool` : optionnel, un service qui implémente l’interface `Psr\Cache\CacheItemPoolInterface` et permet d’éviter des appels inutiles à l’API Ubiflow.

#### Exemple de configuration dans Symfony

[](#exemple-de-configuration-dans-symfony)

```
# config/services.yaml

services:
    # Injection du HttpClient de Symfony
    Symfony\Contracts\HttpClient\HttpClientInterface: '@http_client'

    # Injection du cache (optionnel)
    Psr\Cache\CacheItemPoolInterface: '@cache.app'

    ComCompany\PhpUbiflowApiClient\Client:
        arguments:
            $httpClient: '@Symfony\Contracts\HttpClient\HttpClientInterface'
            $ubiflowClientId: '%env(UBIFLOW_CLIENT_ID)%'
            $ubiflowClientCode: '%env(UBIFLOW_CLIENT_CODE)%'
            $ubiflowClientLogin: '%env(UBIFLOW_CLIENT_LOGIN)%'
            $ubiflowClientSecret: '%env(UBIFLOW_CLIENT_SECRET)%'
            $cachePool: '@Psr\Cache\CacheItemPoolInterface'  # optionnel

    App\Service\MonServiceDePublication:
        arguments:
            $client: '@ComCompany\PhpUbiflowApiClient\Client'
```

Vous pouvez ensuite utiliser votre service :

```
