PHPackages                             bradfeehan/guzzle-modular-service-descriptions - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. bradfeehan/guzzle-modular-service-descriptions

ActiveLibrary[HTTP &amp; Networking](/categories/http)

bradfeehan/guzzle-modular-service-descriptions
==============================================

A better ServiceDescriptionLoader for Guzzle 3.x

v1.3.0(11y ago)2111.5k↓50%32MITPHPPHP &gt;=5.3

Since May 5Pushed 11y ago1 watchersCompare

[ Source](https://github.com/bradfeehan/guzzle-modular-service-descriptions)[ Packagist](https://packagist.org/packages/bradfeehan/guzzle-modular-service-descriptions)[ RSS](/packages/bradfeehan-guzzle-modular-service-descriptions/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (4)Versions (10)Used By (2)

guzzle-modular-service-descriptions
===================================

[](#guzzle-modular-service-descriptions)

[![Build Status](https://camo.githubusercontent.com/e04d9634b0f615a03e9a3833a173cc78909dff7860757786795ee75d43c5e225/68747470733a2f2f7472617669732d63692e6f72672f6272616466656568616e2f67757a7a6c652d6d6f64756c61722d736572766963652d6465736372697074696f6e732e737667)](https://travis-ci.org/bradfeehan/guzzle-modular-service-descriptions)[![Code Coverage](https://camo.githubusercontent.com/774290329264bb4b5aad9c2edf4e1548348ebd2612b8001fa7b20dfcf9c364a6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6272616466656568616e2f67757a7a6c652d6d6f64756c61722d736572766963652d6465736372697074696f6e732f6261646765732f636f7665726167652e706e673f733d66313033383339316266333462663962303932623964643661363932363033653238616435633565)](https://scrutinizer-ci.com/g/bradfeehan/guzzle-modular-service-descriptions/)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6280a0004913f2575bbb5eda44c20c76cea4e5995adae4c0e8095adf07717243/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6272616466656568616e2f67757a7a6c652d6d6f64756c61722d736572766963652d6465736372697074696f6e732f6261646765732f7175616c6974792d73636f72652e706e673f733d36653234353361643066636539363033353664383735656632333037363737666537373637346332)](https://scrutinizer-ci.com/g/bradfeehan/guzzle-modular-service-descriptions/)

A better ServiceDescriptionLoader for [Guzzle 3.x](https://github.com/guzzle/guzzle3)

Features
--------

[](#features)

Guzzle's [service descriptions](https://github.com/guzzle/guzzle3/blob/master/docs/webservice-client/guzzle-service-descriptions.rst) make it easy to describe APIs. A service description takes the form of a JSON object (or PHP associative array) that describes all the available operations and data models supported by the API. However, for large or poorly-designed APIs, the service description can quickly become hard to manage.

This project offers a replacement ServiceDescriptionLoader implementation, which allows for much more flexibility when writing service descriptions. It supports:

- Separating the service description arbitrarily into many files ("modular" service descriptions)
- Alternative formats (plain text and YAML)

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

[](#installation)

To get this library in to an existing project, the best way is to use [Composer](http://getcomposer.org).

1. Add `bradfeehan/guzzle-modular-service-descriptions` as a Composer dependency in your project's [`composer.json`](http://getcomposer.org/doc/01-basic-usage.md#the-require-key "More on the composer.json format") file:

    ```
    {
        "require": {
            "bradfeehan/guzzle-modular-service-descriptions": "~1.0"
        }
    }
    ```
2. If you haven't already, download and [install Composer](http://getcomposer.org/doc/01-basic-usage.md#installation "More detailed installation instructions on the Composer site"):

    ```
    $ curl -sS https://getcomposer.org/installer | php
    ```
3. [Install your Composer dependencies](http://getcomposer.org/doc/01-basic-usage.md#installing-dependencies "More detailed instructions on the Composer site"):

    ```
    $ php composer.phar install
    ```
4. Set up [Composer's autoloader](http://getcomposer.org/doc/01-basic-usage.md#autoloading "More information about the autoloader on the Composer site"):

    ```
    require_once 'vendor/autoload.php';
    ```

Usage
-----

[](#usage)

In contrast to typical Guzzle service descriptions, a modular service description is implemented as a directory. The format of the directory is very flexible. The directory structure is reflected in the heirarchy of the service description data.

#### Format

[](#format)

A file in the root of a modular service description directory defines the key with the name of the file. The content of the file defines the value of that key. As an example, consider the following directory structure:

```
my_service_description/
├── name.txt
└── operations.json

```

The `my_service_description` directory can be loaded as a modular service description. The content inside `name.txt` will be put into the key `name` at the top level of the service description. The content of `operations.json` will be the value for the `operations` key in the service description. (So, to be a valid service description, `operations.json` should contain a JSON object, defining all the operations).

##### Nested directories

[](#nested-directories)

Another, more complex example:

```
complicated_service_description/
├── name.txt
└── operations/
    ├── ComplexOperation/
    │   └── parameters.yml
    └── ComplexOperation.json

```

Again, `name.txt` will contain the value for the `name` key. However, this time, the `operations` key is represented by a directory. The files inside are converted to nested keys in the resulting service description. So this example will result in the following representation:

```
{
    "name": "[content of name.txt]",
    "operations": {
        "ComplexOperation": {
            // The keys defined in ComplexOperation.json
            // will be inserted here
            // ...
            "parameters": "[parsed content of parameters.yml]"
        }
    }
}
```

##### `__index` files

[](#__index-files)

Any files named `__index.[ext]` define the contents of the directory the file is in, rather than the name of the file. It's essentially an "empty" name. This concept is similar to Python's `__init__.py`, which makes the *directory* the package, rather than the *file*.

##### Groups

[](#groups)

Files can also be grouped without causing the contents to be nested. This is useful for organising a large service description. For example, if there are thousands of operations, you'd have to have that many files in the `operations` directory. Using groups, the operations can be grouped logically inside the `operations` directory.

A group is implemented as a directory ending with `.group`. So you could have `Users.group` containing all the operations relating to users, etc.

Note that this could cause problems if you wanted to have a key ending with `.group`. Please let me know by filing a GitHub issue if this causes you any issues, and we can work out a way to compromise.

### Loading the service description

[](#loading-the-service-description)

To load a modular service description, load it using the included loader, and add it to the web service client instance:

```
use BradFeehan\GuzzleModularServiceDescriptions\ServiceDescriptionLoader;
use Guzzle\Service\Client;

// Create a client somehow
$client = Client::factory();

// Instantiate the modular service description loader
$loader = new ServiceDescriptionLoader();

// Point the loader at the modular service description directory
$description = $loader->load('/path/to/service_description');

// Add the service description to the client
$client->setDescription($description);

// Done!
$command = $client->getCommand('MyCommand');

// ...
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 98% 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.

###  Release Activity

Cadence

Every ~7 days

Total

7

Last Release

4355d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d113dbe5b49b854a94ff1d8e7799b381ec38a0847a28584517fb3e0269e943b1?d=identicon)[bradfeehan](/maintainers/bradfeehan)

---

Top Contributors

[![bradfeehan](https://avatars.githubusercontent.com/u/1052806?v=4)](https://github.com/bradfeehan "bradfeehan (48 commits)")[![jimcottrell](https://avatars.githubusercontent.com/u/1483197?v=4)](https://github.com/jimcottrell "jimcottrell (1 commits)")

---

Tags

Guzzleservice description

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bradfeehan-guzzle-modular-service-descriptions/health.svg)

```
[![Health](https://phpackages.com/badges/bradfeehan-guzzle-modular-service-descriptions/health.svg)](https://phpackages.com/packages/bradfeehan-guzzle-modular-service-descriptions)
```

###  Alternatives

[playbloom/guzzle-bundle

Provide Symfony2 web profiler for Guzzle

82311.0k1](/packages/playbloom-guzzle-bundle)[auxmoney/opentracing-bundle-core

Symfony Opentracing bundle to easily enable distributed tracing

25904.4k9](/packages/auxmoney-opentracing-bundle-core)[bradfeehan/desk-php

PHP client for Desk.com v2 API based on Guzzle

2181.4k](/packages/bradfeehan-desk-php)

PHPackages © 2026

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