PHPackages                             heristop/webservice-bundle - 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. heristop/webservice-bundle

ActiveLibrary[API Development](/categories/api)

heristop/webservice-bundle
==========================

This bundle allows to synchronize a table with a soap webservice.

216PHP

Since Feb 6Pushed 12y ago1 watchersCompare

[ Source](https://github.com/heristop/HeriWebServiceBundle)[ Packagist](https://packagist.org/packages/heristop/webservice-bundle)[ RSS](/packages/heristop-webservice-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

WebServiceBundle
================

[](#webservicebundle)

This bundle allows to synchronize a table with a soap webservice.

Installation
------------

[](#installation)

Download sources from github:

```
    [HeriJobQueueBundle]
        git=https://github.com/heristop/HeriWebServiceBundle.git
        target=/bundles/Heri/WebServiceBundle/
```

Or use composer adding the requirement below:

```
{
    "require": {
        "heristop/webservice-bundle": "*"
    }
}
```

Register namespace in autoload:

```
    $loader->registerNamespaces(array(
        ...
        'Heri' => __DIR__.'/../vendor/bundles',
    ));
```

Load in AppKernel:

```
    $bundles[] = new Heri\WebServiceBundle\HeriWebServiceBundle();
```

Usage
-----

[](#usage)

First, add the column *toUpdate* in your entity definition. This field will be set to *false* after the synchronization:

```
    /**
     * @ORM\Column(name="to_update", type="boolean")
     */
    protected $toUpdate;
```

Generate getters and setters:

```
    app/console doctrine:generate:entities %YourBundle%
```

Create a class in *%YourBundle%/Service* directory to apply the mapping with the WSDL. The bundle contains an example:

```
    namespace Heri\Bundle\WebServiceBundle\Service;

    use Heri\Bundle\WebServiceBundle\ClientSoap\ClientObject;

    class Sample extends ClientObject
    {
        public function configure()
        {
            $this->name  = 'sample';
            $this->table = 'HeriWebServiceBundle:Sample';
            $this->func  = 'addSample';
        }

        public function hydrate($record)
        {
            $this->params = array(
                'id'    => $record->getId(),
                'label' => $record->getLabel(),
            );
        }

    }
```

Configure the webservices connection in config.yml:

```
    heri_web_service:
        namespaces:             [ %YourBundleNamespace%\Service ]
        authentication:                      # optional
            login:              %login%
            password:           %password%
        webservices:
            brand:
                name:           brand
                url:            %soap_url%
                authentication: true         # optional
```

Then, use this command to call a webservice and retrieve all the records with *toUpdate* to *true*:

```
    app:console webservice:load %Service%
```

To see the list of available functions add *list* option.

Configuration
-------------

[](#configuration)

Edit config.yml to add *SyncListener*:

```
    services:
       sync.listener:
            class: Heri\Bundle\WebServiceBundle\Listener\SyncListener
            tags:
                - { name: doctrine.event_listener, event: prePersist, connection: default }
                - { name: doctrine.event_listener, event: postPersist, connection: default }
```

JobQueue
--------

[](#jobqueue)

This bundle can be used with [HeriJobQueueBundle](https://github.com/heristop/HeriJobQueueBundle) to manage multiple webservice connections.

Override configuration and add the depedency to jobqueue service in config.yml:

```
    services:
        sync.listener:
            class: Heri\Bundle\WebServiceBundle\Listener\SyncListener
            arguments: [@jobqueue]
            tags:
                - { name: doctrine.event_listener, event: prePersist, connection: default }
                - { name: doctrine.event_listener, event: postPersist, connection: default }
        jobqueue:
            class: Heri\Bundle\JobQueueBundle\Service\QueueService
            arguments: [@logger]
            tags:
                - { name: monolog.logger, channel: jobqueue }
```

Add a method called *synchronize()* in the object which return the name of queue:

```
    /**
     * Adds synchronization in specified queue
     *
     * @return string
     */
    public function synchronize()
    {
        return '%queue_name%';
    }
```

When the record will be saved in database, the synchronization to the webservice will be pushed in queue.

Note
----

[](#note)

You can override the *ClientObject* class in order to apply a specific configuration.

The example below shows the method to connect your application to a Magento plateform:

```
heri_web_service:
    namespaces:             [ %YourBundleNamespace%\Service ]
    authentication:
        login:              sampleuser
        password:           123456
    webservices:
        magento:
            name:           api
            url:            http://myshop-local.com/index.php/api/
```

```
abstract class ClientMagento extends ClientObject
{
    protected $name = 'api';

    protected function callFunction($func, array $params = array())
    {
        $connection = $this->getContainer()->getConnection();
        $sessionId = $this->client->login($connection->getLogin(), $connection->getPassword());

        return $this->client->call(
            $sessionId,
            $func,
            $params
        );
    }
}
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e2c14ee4dd72adb2516c9b82f060cb0536e245fde547e05c72b4e3ec1042d4f?d=identicon)[heristop](/maintainers/heristop)

---

Top Contributors

[![heristop](https://avatars.githubusercontent.com/u/206870?v=4)](https://github.com/heristop "heristop (18 commits)")

### Embed Badge

![Health badge](/badges/heristop-webservice-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/heristop-webservice-bundle/health.svg)](https://phpackages.com/packages/heristop-webservice-bundle)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
