PHPackages                             tumihub/loap - 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. tumihub/loap

ActiveLibrary

tumihub/loap
============

For quickly deploying SOAP services in Laravel and Lumen, with auto-discovery of WSDL definitions.

11341[1 PRs](https://github.com/tumihub/loap/pulls)PHP

Since Aug 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/tumihub/loap)[ Packagist](https://packagist.org/packages/tumihub/loap)[ RSS](/packages/tumihub-loap/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Loap
====

[](#loap)

[![GitHub license](https://camo.githubusercontent.com/ee061e6c1798bd95fa104c910010a3119850b186c323a1c848b3abcb029dc764/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e7376673f6d61784167653d32353932303030)](LICENSE.md)

Instant SOAP server for Laravel and Lumen, turns any class into a WS-I compliant SOAP service, with automatic discovery of WSDL definitions. Wraps the Laminas SOAP components to provide easy declarative configuration of services, requiring no additional coding.

Overview
--------

[](#overview)

### System Requirements

[](#system-requirements)

Laravel or Lumen framework, version 5.2 or greater.

### Basic Steps

[](#basic-steps)

Setting up services is quick and painless:

- Install this package in your Laravel or Lumen application.
- Publish the config file for customization.
- Define configurations for your services.

### Examples

[](#examples)

There is a Demo service already configured and ready to test. This can be used as a template for creating your own services from existing classes. WSDL auto-discovery and generation depends on you having properly annotated your service class attributes and methods with PHP DocBlocks, as illustrated in the `DemoService` class and explained below.

### Architecture

[](#architecture)

This package uses the `document/literal wrapped` pattern in SOAP communications and WSDL generation, but if necessary, the `LoapController` class can be extended to deploy an alternate pattern.

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

[](#installation)

From your Laravel or Lumen application's root directory, install via Composer:

```
composer require tumihub/loap
```

After installing, add the `LoapServiceProvider` to the list of service providers:

### For Laravel

[](#for-laravel)

Add this line in `config/app.php`. If you are using Laravel version 5.5 or greater, this step is not necessary.

```
Tumihub\Loap\LoapServiceProvider::class,
```

### For Lumen

[](#for-lumen)

Add this line in `bootstrap/app.php`:

```
$app->register(Tumihub\Loap\LoapServiceProvider::class);
```

You may also want to install the [irazasyed/larasupport](https://github.com/irazasyed/larasupport) package, which adds a few basic Laravel features to Lumen, including support for publishing package files. This will allow you to publish the Loap config and view files for customization as described [below](#configuration); otherwise, you can just copy those files manually from the package to their published locations.

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

[](#configuration)

The `loap.php` config file contains both general settings and configuration of individual services.

Run this command to publish the `loap.php` config file to the project's `config` directory for customization:

```
php artisan vendor:publish  --tag='loap'
```

This will also publish the SoapFault response template to your project's `resources/views/vendor/loap` directory.

### Logging

[](#logging)

When enabled, full error information, including trace stack, will be logged for exceptions.

### Services

[](#services)

The `LoapController` class configures the server for the service matching the `key` route parameter (see [Routing](#routing) below). In this way you can serve any number of classes with your SOAP server, simply by defining them here.

The Demo service is provided as an example; it's configuration is shown here:

```
    'services'          => [

        'demo'              => [
            'name'              => 'Demo',
            'class'             => 'Tumihub\Loap\Demo\DemoService',
            'exceptions'        => [
                'Exception'
            ],
            'types'             => [
                'keyValue'          => 'Tumihub\Loap\Demo\Types\KeyValue',
                'product'           => 'Tumihub\Loap\Demo\Types\Product'
            ],
            'strategy'          => 'ArrayOfTypeComplex',
            'headers'           => [
                'Cache-Control'     => 'no-cache, no-store'
            ],
            'options'           => []
        ]

    ],
```

#### Name

[](#name)

Specify the name of the service as it will appear in the generated WSDL file.

#### Class

[](#class)

Specify the class you want to serve. Public attributes and methods of this class will be made available by the SOAP server.

#### Exceptions

[](#exceptions)

List any exceptions you want caught and converted to a `SoapFault`. Using `Exception` will catch all exceptions, or you can be more specific and list individual child exceptions. Any exceptions not on this whitelist may return unpredictable results, including no result at all. We don't want to let the server return a `SoapFault` directly, which could expose a stack trace; instead the exception is caught and then returned as a `SoapFault` with the proper message.

#### Types

[](#types)

Add complex types as necessary - typically auto-discovery will find them, but if not they can be specified here - auto-discovery will not redundantly add the same type again anyway.

#### Strategy

[](#strategy)

Specify one of these `ComplexTypeStrategyInterface` implementations to use in auto-discovery:

- AnyType
- ArrayOfTypeComplex
- ArrayOfTypeSequence
- DefaultComplexType

If not specified, the `ArrayOfTypeComplex` strategy will be used.

#### Headers

[](#headers)

A `Content-Type` header of 'application/xml; charset=utf-8' is set automatically if not otherwise specified here. Specify any additional HTTP response headers required.

#### Options

[](#options)

Specify an array of server options for this service (optional).

Routing
-------

[](#routing)

The package routes file routes the Demo service:

```
app()->router->get('loap/{key}/server', [
    'as' => 'loap.server.wsdl',
    'uses' => '\Tumihub\Loap\LoapController@server'
]);

app()->router->post('loap/{key}/server', [
    'as' => 'loap.server',
    'uses' => '\Tumihub\Loap\LoapController@server'
]);
```

Use this route or create new routes as necessary to access your SOAP services on the `LoapController` class, using the same URL parameter `{key}` to indicate the key for a service configuration. The key 'demo' is used to look up the Demo [service configuration](#configuration).

Usage
-----

[](#usage)

SOAP is a complex specification with various implementations, and can be difficult to work with for a number of reasons. This package abstracts much of the implementation details away from the developer.

It remains for you to define your SOAP API using PHP DocBlock notation on all public class attributes and methods; this is used by the auto-discovery process to define your service. See the [Demo](#demo) section below to get a walk-through of a real implementation provided as an example to get you started.

Demo
----

[](#demo)

The Demo SOAP service provided with this package is a simple implementation example, with commonly used configuration values. The `DemoService` class references a fictional provider (`DemoProvider` class) which returns some hard-coded results, simply to illustrate the concept of application functionality exposed as a SOAP service.

Example requests for the Demo service methods are provided below, along with the expected responses. Replace '' in the requests with the actual domain of your Laravel application.

The Demo service class provides an example of how method parameters and return values are automatically transformed by the server to the appropriate data formats. Shown here is the DocBlock of the `getProducts` method in the `DemoService` class:

```
/**
 * Returns an array of products by search criteria.
 *
 * @param \Tumihub\Loap\Types\KeyValue[] $criteria
 * @param string $token
 * @param string $user
 * @param string $password
 * @return \Tumihub\Loap\Types\Product[]
 * @throws SoapFault
 */
 public function getProducts($criteria = [], $token = '', $user = '', $password = '')
```

This method returns an array of `Product` objects, wrapped and formatted as an XML string, [as shown below](#getproducts).

### WSDL Generation

[](#wsdl-generation)

A SOAP server must be provided with a WSDL file to be able to recognize the methods and data models it is expected to handle, but writing one manually is difficult and error-prone, given the complexity of the specification and the lack of good documentation. This package uses auto-discovery to generate the WSDL file automatically.

The WSDL definition of the Demo service can be obtained via GET request to the Demo route with the empty URL parameter `'wsdl'`:

```
http://example.com/loap/demo/server?wsdl

```

It should return a complete WSDL file describing the Demo service.

```

            Authenticates user/password, returning status of true with token, or throws SoapFault.

            Returns boolean authentication result using given token or user/password.

            Returns a product by id.

            Returns an array of products by search criteria.

```

### Service Methods

[](#service-methods)

To access a service method, use a POST request with `Content-Type` header of 'application/xml' or 'text/xml', and body content as shown below. The `user`, `password` and `token` parameters will be authenticated against hard-coded values, so you can see the failure result if you change them. Also included in the Demo service are methods for getting a single product or an array of products, to illustrate the formatting of results from methods returning complex objects.

#### auth

[](#auth)

##### Request

[](#request)

```

            test@test.com
            tester

```

##### Response

[](#response)

```

                    status
                    true

                    token
                    tGSGYv8al1Ce6Rui8oa4Kjo8ADhYvR9x8KFZOeEGWgU1iscF7N2tUnI3t9bX

```

#### ping

[](#ping)

##### Request

[](#request-1)

```

            tGSGYv8al1Ce6Rui8oa4Kjo8ADhYvR9x8KFZOeEGWgU1iscF7N2tUnI3t9bX

```

##### Response

[](#response-1)

```

            true

```

#### getProduct

[](#getproduct)

##### Request

[](#request-2)

```

            456
            tGSGYv8al1Ce6Rui8oa4Kjo8ADhYvR9x8KFZOeEGWgU1iscF7N2tUnI3t9bX

```

##### Response

[](#response-2)

```

                456
                North Face Summit Ski Jacket
                Outerwear
                Women
                249.98

```

#### getProducts

[](#getproducts)

##### Request

[](#request-3)

```

                    category
                    Outerwear

            tGSGYv8al1Ce6Rui8oa4Kjo8ADhYvR9x8KFZOeEGWgU1iscF7N2tUnI3t9bX

```

##### Response

[](#response-3)

```

                    456
                    North Face Summit Ski Jacket
                    Outerwear
                    Women
                    249.98

                    789
                    Marmot Crew Neck Base Layer
                    Outerwear
                    Men
                    95.29

```

Tests
-----

[](#tests)

Using an HTTP client such as [Postman](https://www.getpostman.com/), you can test your services directly with XML requests. A [Postman collection file](tests/Loap.postman_collection.json) for the Demo service is included in this package's `tests` directory; you can run the collection's test suite from within Postman or on the command line via Newman (see Postman docs). Set the collection variable `domain` to your Laravel app's actual domain (instead of '').

License
-------

[](#license)

This software is offered for use under the [MIT License](LICENSE.md).

Changelog
---------

[](#changelog)

Release versions are tracked in the [Changelog](CHANGELOG.md).

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 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/d70d6c3f2584ac7775fa405f6e9facdecab21bb97d572ca7aaf97c8059335f52?d=identicon)[tumihub](/maintainers/tumihub)

---

Top Contributors

[![tumijedi](https://avatars.githubusercontent.com/u/70398878?v=4)](https://github.com/tumijedi "tumijedi (1 commits)")

### Embed Badge

![Health badge](/badges/tumihub-loap/health.svg)

```
[![Health](https://phpackages.com/badges/tumihub-loap/health.svg)](https://phpackages.com/packages/tumihub-loap)
```

PHPackages © 2026

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