PHPackages                             loco/swizzle - 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. loco/swizzle

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

loco/swizzle
============

Build Guzzle service descriptions from Swagger compliant APIs

2.0.2(6y ago)289.7k4[2 issues](https://github.com/loco/swizzle/issues)2MITPHPPHP &gt;=5.5CI failing

Since Feb 10Pushed 6y ago2 watchersCompare

[ Source](https://github.com/loco/swizzle)[ Packagist](https://packagist.org/packages/loco/swizzle)[ Docs](https://github.com/loco/swizzle)[ RSS](/packages/loco-swizzle/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (3)Versions (9)Used By (2)

Swizzle
=======

[](#swizzle)

Build [Guzzle](http://guzzlephp.org) service descriptions from [Swagger](https://helloreverb.com/developers/swagger) compliant APIs.

### What?

[](#what)

- Guzzle is a framework for building HTTP clients in PHP.
- Swagger is a specification for describing RESTful services.

Although Guzzle's service descriptions are [heavily inspiried](http://docs.guzzlephp.org/en/latest/webservice-client/guzzle-service-descriptions.html) by the Swagger spec, they are different enough that we need something to bridge the divide.

Swizzle crawls JSON Swagger docs ([such as ours](https://localise.biz/api/swagger)) and transforms them into a compatible schema for use with [guzzle/guzzle-services](https://github.com/guzzle/guzzle-services).

> **Important!** This library is for use with v1.2 of the Swagger specification which is obsolete.

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

[](#installation)

Installation is via [Composer](http://getcomposer.org/doc/00-intro.md#using-composer).

Add the latest stable version of [loco/swizzle](https://packagist.org/packages/loco/swizzle) to your project's composer.json file as follows:

```
{
  "require": {
    "loco/swizzle": "~2.0"
  }
}
```

If you want to install straight from Github you'll have to write your own [autoloader](https://gist.github.com/jwage/221634) for now.

Usage
-----

[](#usage)

Basic usage is to configure, build and export - as follows:

```
$builder = new Loco\Utils\Swizzle\Swizzle( 'foo', 'Foo API' );
$builder->build('http://foo.bar/path/to/swagger/docs/');
// Serialize Guzzle service config to json
file_put_contents('/path/to/config.json', $builder->toJson());
// Now use saved config.json in your project/library to create Guzzle service.
```

More advanced usage includes registering custom Guzzle classes for commands and responses. See [example](https://github.com/loco/swizzle/tree/master/example) directory for fuller, working examples.

Build the PHP API documentation with [apigen](http://apigen.org/) using `apigen -c apigen.yml`

### Limitations

[](#limitations)

This library supports **only** version 1.2 of the old Swagger specification. We developed this very quickly for our own needs, and haven't kept up with the newer [OpenAPI](https://swagger.io/specification/) project.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 95.3% 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 ~351 days

Recently: every ~525 days

Total

7

Last Release

2368d ago

Major Versions

1.0.4 → 2.0.02018-02-14

PHP version history (2 changes)1.0.1PHP &gt;=5.3.3

2.0.0PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/7949205dc127b0404297d8fa601585faa9d1f4eeee9b3f57b0be65c1a70f2bcc?d=identicon)[timwhitlock](/maintainers/timwhitlock)

![](https://www.gravatar.com/avatar/5479253acd5bc25720cc5d5a0c582744300f92fa2ba927fdd5c5a3b44c5b246e?d=identicon)[loco](/maintainers/loco)

---

Top Contributors

[![supersmile2009](https://avatars.githubusercontent.com/u/25199815?v=4)](https://github.com/supersmile2009 "supersmile2009 (41 commits)")[![Konafets](https://avatars.githubusercontent.com/u/363363?v=4)](https://github.com/Konafets "Konafets (1 commits)")[![timwhitlock](https://avatars.githubusercontent.com/u/160589?v=4)](https://github.com/timwhitlock "timwhitlock (1 commits)")

---

Tags

apiGuzzleswagger

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/loco-swizzle/health.svg)

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

###  Alternatives

[ajt/guzzle-toggl

Toggl API client written on top of Guzzle PHP.

8826.2k2](/packages/ajt-guzzle-toggl)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[antoinelemaire/aircall-php

Aircall API client built on top of Guzzle 6

1049.6k](/packages/antoinelemaire-aircall-php)

PHPackages © 2026

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