gorkalaucirica/hipchat-v2-api-client
A PHP client for the HipChat v2 API that wraps rooms, users, messages, and other endpoints in a simple interface. It handles authentication and API requests so you can integrate HipChat features into PHP or Laravel apps quickly.
Before anything else: this package talks to Hipchat's v2 REST API, and Atlassian shut Hipchat down in 2019 — api.hipchat.com no longer resolves. The package itself is marked unmaintained and hasn't shipped a release since April 2016. So "getting started" realistically means one of two things: you've inherited a codebase that still references it and need to keep it compiling (or remove it), or you're reading it as a reference implementation for a thin Guzzle-based API client.
Minimum steps:
composer require gorkalaucirica/hipchat-v2-api-client. Expect conflicts against modern guzzlehttp/guzzle and PHP 8.x; if you just need it to install for archaeology, use a throwaway project or --ignore-platform-reqs.src/API.php first — it is effectively the package's documentation, since it enumerates every endpoint wrapper (getRoom, getAllRooms, sendRoomNotification, getUser, createUser, webhooks, emoticons, etc.). Then read src/Client.php for the transport layer and src/Auth/ for token handling. src/Model/ holds the DTOs (Room, User, Message, …).use GorkaLaucirica\HipchatAPIv2Client\API;
use GorkaLaucirica\HipchatAPIv2Client\Auth\TokenAuth;
use GorkaLaucirica\HipchatAPIv2Client\Client;
$api = new API(new Client(new TokenAuth(config('services.hipchat.token'))));
$api->sendRoomNotification($roomId, 'Deploy finished', 'green', true);
Exact method signatures drift between versions, so verify against src/API.php in the tag you've installed rather than trusting snippets.
Your first real use case is almost certainly a build/deploy notifier posting into a room — that's what 90% of consumers of this library did.
Bind it once, inject it everywhere. Register a singleton in a service provider so the Guzzle client (and its connection pool) is reused, and keep the token in config/services.php:
$this->app->singleton(API::class, fn () => new API(
new Client(new TokenAuth(config('services.hipchat.token')))
));
Add a Hipchat facade over that binding if you want the terse Hipchat::sendRoomNotification(...) call style in controllers.
Wrap it, don't sprinkle it. Because the package is dead, treat its namespace as an implementation detail. Put a HipchatNotifier interface in your app, implement it with this package, and inject that. When you eventually swap to Slack/Teams webhooks, only one class changes.
Push calls onto the queue. Notification sends are I/O to a third party; do them in a queued job with $tries = 3 and backoff(). This also means a Hipchat timeout can't take down a request cycle.
Resolve names to IDs once. The API is ID-centric — room and user lookups are by numeric ID. If your config says #deployments, do the name→ID lookup at boot or cache it; don't call getAllRooms() on every notification.
Test by injecting a fake HTTP client. Client accepts a Guzzle ClientInterface, so you can pass a MockHandler-backed client and assert on the request path/body without touching the network. Alternatively mock your own HipchatNotifier and skip the package entirely in tests.
Add logging via the handler stack. Rather than editing the package, configure the Guzzle client you inject with a Middleware::log() / Middleware::history() handler — that's the cleanest extension point it offers.
204 No Content. Don't assume every call returns a hydrated Model — check the return type of the specific method in API.php.GuzzleHttp\Exception\* depending on where in the stack they occur. Catch broadly at your notifier boundary and normalise, rather than catching the package classes in business logic.sendRoomNotification is usually a scope problem, not a payload problem.html from text; passing HTML in a text message renders tags literally. Similarly, notify controls whether the room pings — leave it false for chatty build output.Client.php for how the endpoint host is constructed; if it's baked in, that's your first patch point when pointing at a mock server in tests.AuthInterface for non-token auth, inject a custom Guzzle client for transport/proxy/logging changes, and subclass API if you need endpoints the package never wrapped.Http::post() in Laravel) — you get the same outcome with zero unmaintained dependencies.How can I help you explore Laravel packages today?