NacexBundle, a PHP bundle

Today I am releasing one of the php bundles we made for Selltag, the NacexBundle.

NacexBundle is a bundle implementing a client/service to call the Nacex SOAP API, the transport company Nacex API.

We use it with Symfony, but you could use It as you please. :-)

You can read the instructions for Installing and configuring It, basically It would be something like:

Install through composer.

composer require selltag/nacex-bundle

Configure the service parameters.

selltag_nacex:
    nacex_password: %nacex_username%
    nacex_password: %nacex_password%
    nacex_url: %nacex_url%

You can define nacex_username, nacex_password and nacex_url in your parameters.yml.

In symfony you could use It as a service from the container.

$nacexClient = $this->getContainer()
    ->get('selltag_nacex.nacex_client');

$data = array(
    'reco_codigo' => null,
    'Del_Sol'     => '0001',
    'Num_Rec'     => '123456',
    'ref'         => null
);

$result = $nacexClient->putRecogida($data);

$recogida = array(
    'code'        => $result[0],
    'date'        => $result[1],
    'time'        => $result[2],
    'observation' => $result[3],
    'status'      => $result[4],
    'status_code' => $result[5]
);

If you don't want to use It as a service, you can just:

use Selltag\NacexBundle\Services\NacexClientService;

$nacexClient = new NacexClientService(
    $nacexUser,
    $nacexPassword,
    $nacexUrl
);

Questions?

Javier Aguirre

Read more posts by this author.

comments powered by Disqus