PHPackages                             hugsbrugs/php-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. hugsbrugs/php-api

ActiveLibrary[API Development](/categories/api)

hugsbrugs/php-api
=================

PHP API Utilities

032[3 issues](https://github.com/hugsbrugs/php-api/issues)[3 PRs](https://github.com/hugsbrugs/php-api/pulls)PHP

Since Jun 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/hugsbrugs/php-api)[ Packagist](https://packagist.org/packages/hugsbrugs/php-api)[ RSS](/packages/hugsbrugs-php-api/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (4)Used By (0)

php-api
=======

[](#php-api)

This librairy provides utilities function to group different API calls for a single project entry point. Based on [Tonic](https://github.com/peej/tonic).

Install
-------

[](#install)

Install package with composer

```
composer require hugsbrugs/php-api

```

In your PHP code, load library

```
require_once __DIR__ . '/../vendor/autoload.php';
use Hug\Api\Api as Api;
```

Usage
-----

[](#usage)

### Edit config.php

[](#edit-configphp)

Set your parameters. Visit Tonic documentation for params.

### Put dispatch.php and .htaccess files in api folder

[](#put-dispatchphp-and-htaccess-files-in-api-folder)

If you want to access your API through /api subfolder, create this folder at your webroot directory and copy .htaccess (which will redirect all traffic to dispatch.php) and dispatch.php (which will route your API requests)

### Create your API classes

[](#create-your-api-classes)

Look at TestApi.php and create your API endpoints extending

```
Hug\Api\ApiResource
```

Based on Tonic syntax

### Consume your API

[](#consume-your-api)

In your browser visit your endpoints or do CURL requests to test POST, PUT, DELETE methods.

Changelog
---------

[](#changelog)

28/09/2023 - Migration for PHP 8 Replace "peej/tonic" : "dev-master", By "neekfenwick/tonic" : "^3.4.1",

Author
------

[](#author)

Hugo Maugey [visit my website ;)](https://hugo.maugey.fr)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity30

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

---

Top Contributors

[![hugsbrugs](https://avatars.githubusercontent.com/u/4385090?v=4)](https://github.com/hugsbrugs "hugsbrugs (7 commits)")

### Embed Badge

![Health badge](/badges/hugsbrugs-php-api/health.svg)

```
[![Health](https://phpackages.com/badges/hugsbrugs-php-api/health.svg)](https://phpackages.com/packages/hugsbrugs-php-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)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

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

PHP wrapper for the Meilisearch API

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

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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