PHPackages                             mateffy/huggingface - 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. mateffy/huggingface

ActiveLibrary

mateffy/huggingface
===================

An unofficial Huggingface Inference API client for PHP

1.0.5(1y ago)125↓100%MITPHP

Since Jan 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Capevace/huggingface-php)[ Packagist](https://packagist.org/packages/mateffy/huggingface)[ RSS](/packages/mateffy-huggingface/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

HuggingFace API client for PHP
==============================

[](#huggingface-api-client-for-php)

A PHP SDK to interact with the HuggingFace API using just a few lines of code.

🧑‍💻 Step 1: Installation
------------------------

[](#‍-step-1-installation)

```
composer require mateffy/huggingface
```

🚀 Step 2: Usage
---------------

[](#-step-2-usage)

```
use Mateffy\HuggingFace;

$token = 'API_TOKEN';

$client = new HuggingFace($token);

$emotions = $client->run(
    model: 'j-hartmann/emotion-english-distilroberta-base',
    input: 'I am happy',
);
/* -> [['label' => 'happy', 'score' => 0.9999], ...] */

/*
 * Shorthand version:
 */

$emotions = HuggingFace::inference(
    token: $token,
    model: 'j-hartmann/emotion-english-distilroberta-base',
    /* Passing a single input will make the response also be a single value */
    input: 'I am happy',
);
/* -> [['label' => 'happy', 'score' => 0.9999], ...] */

/*
 * or with multiple inputs
 */

$result = $client->run(
    model: 'j-hartmann/emotion-english-distilroberta-base',
    /* Multiple inputs will return an array of results */
    inputs: [
        'I am happy',
        'I am sad',
    ]
);
/*
 * -> [
 *      [['label' => 'happy', 'score' => 0.9999], ...]],
 *      [['label' => 'sad', 'score' => 0.9999], ...]],
 * ]
 */
```

Changelog
---------

[](#changelog)

### 1.0.5

[](#105)

- feat: better error handling

### 1.0.4

[](#104)

- feat: better API for single/multiple inputs

### 1.0.3

[](#103)

- fix: added response data as return value

### 1.0.2

[](#102)

- fix: added autoload to composer.json

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance42

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 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 ~0 days

Total

5

Last Release

469d ago

### Community

Maintainers

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

---

Top Contributors

[![Capevace](https://avatars.githubusercontent.com/u/10093858?v=4)](https://github.com/Capevace "Capevace (9 commits)")

### Embed Badge

![Health badge](/badges/mateffy-huggingface/health.svg)

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

###  Alternatives

[skagarwal/google-places-api

Google Places Api

1913.0M8](/packages/skagarwal-google-places-api)[saloonphp/laravel-plugin

The official Laravel plugin for Saloon

765.7M124](/packages/saloonphp-laravel-plugin)[ohdearapp/ohdear-php-sdk

An SDK to easily work with the Oh Dear API

742.6M13](/packages/ohdearapp-ohdear-php-sdk)[saloonphp/rate-limit-plugin

Handle rate limits beautifully in your Saloon API integrations or SDKs

201.3M43](/packages/saloonphp-rate-limit-plugin)[saloonphp/cache-plugin

Official plugin for caching Saloon responses

122.0M64](/packages/saloonphp-cache-plugin)[myoutdeskllc/salesforce-php

salesforce library for php8+

1560.8k](/packages/myoutdeskllc-salesforce-php)

PHPackages © 2026

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