PHPackages                             tripomatic/nette-api - 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. [API Development](/categories/api)
4. /
5. tripomatic/nette-api

ActiveLibrary[API Development](/categories/api)

tripomatic/nette-api
====================

Build REST APIs with Nette Framework

53.1kPHP

Since Oct 21Pushed 10y ago7 watchersCompare

[ Source](https://github.com/tripomatic/nette-api)[ Packagist](https://packagist.org/packages/tripomatic/nette-api)[ RSS](/packages/tripomatic-nette-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

Tripomatic\\NetteApi
====================

[](#tripomaticnetteapi)

Build REST APIs with [Nette Framework](http://nette.org).

Tripomatic\\NetteApi is a very light base for building REST APIs with Nette Framework. It provides an extremely minimalist [base presenter](src/Application/Presenter.php), an [error presenter](src/Application/Presenters/ErrorPresenter.php) that ensures returning a valid JSON on any error and takes care of logging, and a handy JSON prettifier for testing APIs in browser that does not force you to hide your [Tracy](http://tracy.nette.org) panel.

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

[](#installation)

Install Tripomatic\\NetteApi using [Composer](https://getcomposer.org):

```
$ composer require tripomatic/nette-api
```

Quickstart
----------

[](#quickstart)

Add Tripomatic\\NetteApi extension in your [NEON config](http://doc.nette.org/en/2.3/configuring):

```
extensions:
  	api: Tripomatic\NetteApi\DI\ApiExtension
```

Create your first RESTful presenter inherited from minimalist [`Tripomatic\NetteApi\Application\Presenter`](src/Application/Presenter.php):

```
use Nette\Application\Request;
use Tripomatic\NetteApi\Application\Presenter;
use Tripomatic\NetteApi\Application\Responses\JsonResponse;

class WeatherPresenter extends Presenter
{
	public function get(Request $request)
	{
		$city = $request->getParameter('city');

		$data = ...; // get weather data for the city
		return new JsonResponse($data);
	}

	// implement ohter REST methods similarly
}
```

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

[](#configuration)

Tripomatic\\NetteApi does not require any additional configuration, it sets up two handy defaults:

- An error presenter is set up that ensures the API returns a valid JSON in all error situations.
- API responses are prettified by default when running in debug mode, Tracy panel is also visible.

This behavior can be easily overridden in corresponding extension's section:

```
api:
	prettify: %debugMode% # can be set to TRUE/FALSE
	errorPresenter: NetteApi:Error
	mapping:
		NetteApi: 'Tripomatic\NetteApi\Application\Presenters\*Presenter'
```

Bootsraping
-----------

[](#bootsraping)

If you need some help with writing your application bootsrap here is an example that we use in Tripomatic:

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

$tomDebug = getenv('TOM_DEBUG') === 'TRUE' && isset($_COOKIE['tom_api_debug']);
$tomLogDir = getenv('TOM_LOG_DIR') ?: '/var/log/tripomatic/some-api';
$tomTmpDir = getenv('TOM_TMP_DIR') ?: '/var/tmp/some-api';
$tomConfigFile = getenv('TOM_CONFIG_FILE') ?: __DIR__ . '/../config/config.local.neon';

$configurator = new Nette\Configurator;
$configurator->setDebugMode($tomDebug);
$configurator->enableDebugger($tomLogDir);

$configurator->setTempDirectory($tomTmpDir);
$configurator->addConfig(__DIR__ . '/../config/config.neon');
if (file_exists($tomConfigFile)) {
	$configurator->addConfig($tomConfigFile);
}

return $configurator->createContainer();
```

Yes, with Nette Framework it can really be that minimalist. Everything else can be achieved with Nette's great [Dependency Injection implementation](http://doc.nette.org/en/2.3/dependency-injection). For more details see [Nette Framework documentation](http://doc.nette.org/en/2.3).

License
-------

[](#license)

Tripomatic\\NetteApi is licensed under [MIT](LICENSE).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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/89b00846b968f3a65171e5c8b752e6eaddae71c0e7ee070ed90a6636d66038e2?d=identicon)[JanJakes](/maintainers/JanJakes)

---

Top Contributors

[![JanJakes](https://avatars.githubusercontent.com/u/141436?v=4)](https://github.com/JanJakes "JanJakes (4 commits)")[![costasovo](https://avatars.githubusercontent.com/u/1082140?v=4)](https://github.com/costasovo "costasovo (2 commits)")

### Embed Badge

![Health badge](/badges/tripomatic-nette-api/health.svg)

```
[![Health](https://phpackages.com/badges/tripomatic-nette-api/health.svg)](https://phpackages.com/packages/tripomatic-nette-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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