Skip to content

goetas-webservices/ups-ship-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UPS Ship Service SOAP PHP client

This project provides a SOAP client for the UPS Ship service

Installing

The recommended way to install goetas-webservices/ups-ship-client is using Composer, just run:

composer require goetas-webservices/ups-ship-client

Features

  • Pure PHP, no dependencies on ext-soap
  • Complete IDE type hinting support
  • PSR-7 HTTP messaging compatible
  • Multi HTTP client (guzzle, buzz, curl, react)
  • No WSDL/XSD parsing on production
  • Extensible (event listeners support)

Usage

<?php

use GoetasWebservices\SoapServices\SoapClient\ClientFactory;
use GoetasWebservices\SoapServices\SoapClient\Builder\SoapContainerBuilder;
use GoetasWebservices\Client\UPSShipService\SoapContainer;
use GoetasWebservices\Client\UPSShipService\SoapStubs\ShipService;

require __DIR__ . '/vendor/autoload.php';

// project initialization
$container = new SoapContainer();

// use this when cloning this repository and keeping the directory, comment it when including goetas-webservices/ups-ship-client via composer
$serializer = SoapContainerBuilder::createSerializerBuilderFromContainer($container)->build();

// uncomment this when including goetas-webservices/ups-ship-client via composer
// $serializer = SoapContainerBuilder::createSerializerBuilderFromContainer($container, null, __DIR__ . '/vendor/goetas-webservices/ups-ship-client')->build();

$metadata = $container->get('goetas_webservices.soap_client.metadata_reader');
$factory = new ClientFactory($metadata, $serializer);

/**
 * @var $client ShipService
 */
$client = $factory->getClient('SCHEMA-WSDLs/Ship.wsdl','ShipPort', 'ShipService');


$result = $client->ProcessShipment(/* put here your params */);

var_dump($result);

Note

The code in this project is provided under the MIT license. For professional support contact goetas@gmail.com or visit https://www.goetas.com