PHPackages                             avalanche-development/talus - 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. [Framework](/categories/framework)
4. /
5. avalanche-development/talus

ActiveLibrary[Framework](/categories/framework)

avalanche-development/talus
===========================

Microframework with Swagger routing

1.8.2(9y ago)0490MITPHPPHP &gt;=5.6.0

Since May 27Pushed 9y ago2 watchersCompare

[ Source](https://github.com/avalanche-development/talus)[ Packagist](https://packagist.org/packages/avalanche-development/talus)[ RSS](/packages/avalanche-development-talus/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (12)Versions (38)Used By (0)

talus
=====

[](#talus)

PHP microframework that leverages [swagger](http://swagger.io/) documentation to handle routing.

[![Build Status](https://camo.githubusercontent.com/8c8ec450afec38f694948145971efae9f45a08b4e02b08c950cd4ead14a001c5/68747470733a2f2f7472617669732d63692e6f72672f6176616c616e6368652d646576656c6f706d656e742f74616c75732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/avalanche-development/talus)[![Code Climate](https://camo.githubusercontent.com/767b4057fb142ce6e05a750b775f60c4e8a7351720f67427a43cb289bb55e817/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6176616c616e6368652d646576656c6f706d656e742f74616c75732f6261646765732f6770612e737667)](https://codeclimate.com/github/avalanche-development/talus)[![Test Coverage](https://camo.githubusercontent.com/a591033e3d2efd11a85de6f07503a43809f248ab19771c0afb9cdb2fca720ff9/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6176616c616e6368652d646576656c6f706d656e742f74616c75732f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/avalanche-development/talus/coverage)

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

[](#installation)

It's recommended that you use [Composer](https://getcomposer.org/) to install talus.

```
$ composer require avalanche-development/talus
```

talus requires PHP 5.6 or newer.

Usage
-----

[](#usage)

This microframework uses [swagger-router-middleware](https://github.com/avalanche-development/swagger-router-middleware) to parse and understand a provided swagger documentation. It also uses [peel](https://github.com/avalanche-development/peel) http exceptions and [crash-pad](https://github.com/avalanche-development/crash-pad) to standardize error responses. To instantiate talus, you'll need to provide the swagger document in the form of an array.

```
$talus = new AvalancheDevelopment\Talus\Talus([..swagger..]);
```

The parsed swagger information is available via the `swagger` attribute on the request. In your application, you can access this information like so.

```
function ($request, $response) {
  $someParameter = $request->getAttribute('swagger')['params']['someParameter'];
}
```

### Controllers

[](#controllers)

Controllers are attached to routes by the operationId in the swagger spec. Each operation should have a unique operationId, and this will inform talus which controller to invoke. Controllers must be callable and have a `function ($request, $response)` interface.

```
$talus->addController('getThing', function ($request, $response) {
  // get that thing
});

$talus->addController('getComplexThing', function ($request, $response) use ($db) {
  return (new Controller($db))->getComplexThing($request, $response);
});
```

### Middleware

[](#middleware)

Middleware can be added onto the stack and will be executed in the order they are added. As a note, the first executed piece of middleware will always be `swagger-router-middleware` (which will give you a `swagger` attribute with all sorts of goodies in it) and the last executed piece will always be the provided controller callable.

```
$talus->addMiddleware(function ($request, $response, $next) {
  // do something
  return $next($request, $response);
});

```

### Error Handling

[](#error-handling)

Any exceptions thrown during the stack, which includes routing errors and request body parsing failures, will be caught and passed through to the error handler. Some of these exceptions implement `HttpErrorInterface` `peel`, making them easier to deal with. The default error handler `crash-pad` provided will handle this and return a standard response, though you can totally roll your own.

```
$talus->setErrorHandler(function ($request, $response, $exception) {
  // do something with that exception
  return $response;
});

```

It is recommended that you throw exceptions, especially `peel` ones, within your controllers instead of trying to handle the error yourself. This will keep things standardized.

### Execution

[](#execution)

Once the controllers are set, middleware is stacked on, and error handler is customized, all that's left to do is to run the app. This will walk through the middleware stack and execute the appropriate controller, then walk back through middleware and output the provided response object. If there are any problems along the way the error handler should capture them and return a relevant error message.

```
$talus = new AvalancheDevelopment\Talus\Talus([..swagger..]);

$talus->addController(..callback..);
$talus->addMiddleware(..callback..);

$talus->run();

```

### Documentation Route

[](#documentation-route)

This is a feature of `swagger-router-middleware`. If the standard 'documentation route' is detected (path of /api-docs), the rest of the stack is immediately skipped and the swagger spec is returned as json. An error with json\_encode will throw a standard \\Exception.

### Tests

[](#tests)

To execute the test suite, you'll need phpunit (and to install package with dev dependencies).

```
$ phpunit
```

License
-------

[](#license)

talus is licensed under the MIT license. See [License File](LICENSE) for more information.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity70

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~10 days

Total

36

Last Release

3308d ago

Major Versions

0.6.0 → 1.0.02016-11-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a4eb553ed7677c6aa2c5adb9d20191557e64369c14a9d4b2371c924c4517dff?d=identicon)[jacobemerick](/maintainers/jacobemerick)

---

Top Contributors

[![jacobemerick](https://avatars.githubusercontent.com/u/527814?v=4)](https://github.com/jacobemerick "jacobemerick (161 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/avalanche-development-talus/health.svg)

```
[![Health](https://phpackages.com/badges/avalanche-development-talus/health.svg)](https://phpackages.com/packages/avalanche-development-talus)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k86.9M2.2k](/packages/symfony-symfony)[cakephp/cakephp

The CakePHP framework

8.8k19.1M1.7k](/packages/cakephp-cakephp)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k496.1k33](/packages/neuron-core-neuron-ai)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)

PHPackages © 2026

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