PHPackages                             uhura2/uhura - 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. uhura2/uhura

ActiveLibrary[API Development](/categories/api)

uhura2/uhura
============

A communications officer for RESTful apis

0.7(9y ago)07MITPHPPHP &gt;=5.5

Since Nov 21Pushed 6y agoCompare

[ Source](https://github.com/smurfiez/uhurapersonal)[ Packagist](https://packagist.org/packages/uhura2/uhura)[ RSS](/packages/uhura2-uhura/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (11)Used By (0)

Uhura
=====

[](#uhura)

A communications officer for RESTful APIs

Uhura is a dead simple RESTful API client for just about anything. No need to set up schemas or configure API endpoints, just tell Uhura what you want and go get it.

```
$github = new Uhura('https://api.github.com');
$response = $github->users->colindecarlo->repos->get();
```

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

[](#installation)

Install Uhura using composer.

```
$ composer require uhura/uhura
```

Making Requests
---------------

[](#making-requests)

Uhura maps what you ask for in your Demeter chain over to the URL that is used to access the resource you want.

### Examples

[](#examples)

**Send a GET request to `http://someapi.com/users`**

```
$uhura = new Uhura('http://someapi.com');
$response = $uhura->users->get();
```

**Send a GET request to `http://someapi.com/users/1`**

```
$uhura = new Uhura('http://someapi.com');
$response = $uhura->users(1)->get();
```

**Send a GET request to `http://someapi.com/users/1/blogs/some-blog/comments`**

```
$uhura = new Uhura('http://someapi.com');
$response = $uhura->users(1)->blogs('some-blog')->comments->get();
```

### CRUD

[](#crud)

CRUD operations are super simple with Uhura and are mapped to the `create`, `get`, `update` and `delete` methods respectively.

OperationMethod SignatureCreate`create($payload)`Read`get()`Update`update($payload)`Delete`delete()`**`create(array $payload)`**

Use Uhura's `create` method to create resources. The `create` method accepts an associative array of attributes which are sent to the API in the request body as a `x-www-form-urlencoded` string.

```
$uhura = new Uhura('http://someapi.com');
$uhura->users->create(['email' => 'example@example.com']);
```

**`get()`**

Use Uhura's `get` method to get API resources.

```
$uhura = new Uhura('http://someapi.com');
$response = $uhura->users->get();
```

**`update($payload)`**

Use Uhura's `update` method to update a resource. The `update` method accepts an associative array of attributes which are sent to the API in the request body as a `x-www-form-urlencoded` string.

```
$uhura = new Uhura('http://someapi.com');
$uhura->users(1)->update(['name' => 'John Doe']);
```

**`delete()`**

Use Uhura's `delete` method to delete a resource.

```
$uhura = new Uhura('http://someapi.com');
$uhura->users(1)->delete();
```

### Authentication

[](#authentication)

Uhura makes authenticated requests by adding the `Authorization` header to each request that is made.

**Using HTTP Basic Auth**

Tell Uhura to use HTTP Basic Auth with the `useBasicAuthentication($username, $password)` method.

```
$uhura = new Uhura('https://someapi.com');
$uhura->useBasicAuthentication('someuser', 'somepassword');

$uhura->user->update(['email' => 'example@example.com']);
```

**Explicitly Setting the Authorization Header**

You can explicitly set the value of the `Authorization` header by using Uhura's `authenticate($token)` method.

```
$uhura = new Uhura('https://someapi.com');
$uhura->authenticate('Bearer somebearertoken');

$uhura->user->update(['email' => 'example@example.com']);
```

Working With Responses
----------------------

[](#working-with-responses)

By default, Uhura returns [PSR7 compliant](http://www.php-fig.org/psr/psr-7) response objects. Working with them would be as simple as, oh I don't know, a `GuzzleHttp\Psr7\Response` object.

### Response Handlers

[](#response-handlers)

You can tell Uhura to pass API responses through a Response Handler to augment the return value of the various request methods. For instance, Uhura ships with a `Json` Response Handler which consumes the response and returns the decoded JSON response body.

```
$uhura = new Uhura('https://someapi.com');
$uhura->useResponseHandler(new Uhura\ResponseHandler\Json);

$uhura->users(1)->get();
/*
    [
        'email' => 'example@example.com',
        'name' => 'John Doe'
    ]
*/
```

**Writing Custom Response Handlers**

Writing your own custom response handler is super simple. Response Handlers are just simple classes which define a `handle($response)` method. Whatever is returned from the `handle` method is what Uhura will return to you.

```
// XML Response Handler
class XmlHandler
{
    public function handle($response)
    {
        return new SimpleXMLElement($response->getBody()->getContents());
    }
}

$uhura = new Uhura('https://someapi.com');
$uhura->useResponseHandler(new XmlHandler);

echo (string)($uhura->users(1)->get());

/*

        example@example.com
        John Doe

*/
```

Author
------

[](#author)

Colin DeCarlo,

License
-------

[](#license)

Uhura is licensed under the MIT License - see the LICENSE file for details.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70% 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 ~64 days

Recently: every ~111 days

Total

8

Last Release

3428d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5055445?v=4)[smurfiez](/maintainers/smurfiez)[@smurfiez](https://github.com/smurfiez)

---

Top Contributors

[![colindecarlo](https://avatars.githubusercontent.com/u/682860?v=4)](https://github.com/colindecarlo "colindecarlo (21 commits)")[![smurfiez](https://avatars.githubusercontent.com/u/5055445?v=4)](https://github.com/smurfiez "smurfiez (5 commits)")[![chapeupreto](https://avatars.githubusercontent.com/u/834048?v=4)](https://github.com/chapeupreto "chapeupreto (1 commits)")[![dansoppelsa](https://avatars.githubusercontent.com/u/933435?v=4)](https://github.com/dansoppelsa "dansoppelsa (1 commits)")[![grantlovell](https://avatars.githubusercontent.com/u/83667?v=4)](https://github.com/grantlovell "grantlovell (1 commits)")[![veganista](https://avatars.githubusercontent.com/u/405763?v=4)](https://github.com/veganista "veganista (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/uhura2-uhura/health.svg)

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

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M971](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.5M7](/packages/avalara-avataxclient)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1943.1k5](/packages/aimeos-prisma)

PHPackages © 2026

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