PHPackages                             altelma/laravel-hydra - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. altelma/laravel-hydra

ActiveLibrary[HTTP &amp; Networking](/categories/http)

altelma/laravel-hydra
=====================

Hydra API client for Laravel

v0.0.3(4y ago)312.8kMITPHP

Since Feb 11Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/ALTELMA/laravel-hydra)[ Packagist](https://packagist.org/packages/altelma/laravel-hydra)[ RSS](/packages/altelma-laravel-hydra/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

Laravel Hydra
=============

[](#laravel-hydra)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8adeaf466d89661186e9df95ca2ac145bb21b84e61a13b899cf311bb5267fa3a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c74656c6d612f6c61726176656c2d68796472612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/altelma/laravel-hydra)[![Total Downloads](https://camo.githubusercontent.com/0fd291ad20abcd0a2cb77d96b84f204dc4f6a5c552f842ae45c17c199ddddcd7/68747470733a2f2f706f7365722e707567782e6f72672f414c54454c4d412f6c61726176656c2d68796472612f642f746f74616c2e737667)](https://packagist.org/packages/altelma/laravel-hydra)

Laravel Hydra is a package that provides Client API for Hydra support Laravel and following the newest of PHP version.

[![Laravel Hydra Cover](https://user-images.githubusercontent.com/4938568/153674325-d98af9de-cd43-46de-a4ca-34b1b5935aa2.jpg)](https://user-images.githubusercontent.com/4938568/153674325-d98af9de-cd43-46de-a4ca-34b1b5935aa2.jpg)

What is Hydra?
--------------

[](#what-is-hydra)

Hydra is an OAuth 2.0 and OpenID Connect Provider. In other words, an implementation of the OAuth 2.0 Authorization Framework as well as the OpenID Connect Core 1.0 framework. As such, it issues OAuth 2.0 Access, Refresh, and ID Tokens that enable third-parties to access your APIs in the name of your users.

Inspiration ❤️❤️❤️
------------------

[](#inspiration-️️️)

This is not the official Ory Hydra SDK for php. If you want to use the official SDK, please use the official [Ory Hydra SDK](https://github.com/ory/hydra-client-php)

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

[](#installation)

`composer require altelma/laravel-hydra`

Usage
-----

[](#usage)

### Create OAuth Client

[](#create-oauth-client)

```
// Create OAuth Client
$adminApi = new AdminApi();
$adminApi->createOAuth2Client([
    "client_id" => "my-client-id",
    "client_name" => "My Client ID",
    "client_secret" => Str::random(32),
    "scope" => "offline offline_access openid phone email profile",
    "owner" => "Your company or your 3rd",
    "client_uri" => "https://your-company.com",
    "logo_uri" => "https://your-client-app.com/logo.png",
    "redirect_uris" => [
        "http://localhost:8000/hydra/callback",
    ],
    "grant_types" => [
        "authorization_code|refresh_token"
    ],
    "response_types" => [
        "code|id_token"
    ],
]);

```

### Token Verification

[](#token-verification)

```
// Example in middleware
public function __construct(private AdminApi $oauthAdminApi)
{
}

public function handle(Request $request, Closure $next)
{
    $token = $request->bearerToken();
    $tokenVerification = $this->oauthAdminApi->introspectOAuth2Token($token)->active;
    if (!$tokenVerification) {
        throw new UnauthorizedHttpException('Bearer', 'Invalid access token');
    }

    return $next($request);
}

```

Reference
---------

[](#reference)

HTTP API Documentation:

สนับสนุนผมได้นะ ☕
-----------------

[](#สนับสนุนผมได้นะ-)

สวัสดีเพื่อนๆ ทุกคนนะครับ หากมีข้อเสนอแนะอะไร แนะนำมาได้นะครับ นอกจากนี้ เพื่อนๆ สามารถแวะไปอ่านบทความของผมเพิ่มเติมได้ [ที่นี่](https://medium.com/@altelma) ครับ

Bug Report
----------

[](#bug-report)

This package is not perfect right, but can be improve together. If you found bug or have any suggestion. Send that to me or new issue. Thank you to use it.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90% 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 ~45 days

Total

3

Last Release

1460d ago

### Community

Maintainers

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

---

Top Contributors

[![ALTELMA](https://avatars.githubusercontent.com/u/4938568?v=4)](https://github.com/ALTELMA "ALTELMA (9 commits)")[![deepsource-io[bot]](https://avatars.githubusercontent.com/in/16372?v=4)](https://github.com/deepsource-io[bot] "deepsource-io[bot] (1 commits)")

---

Tags

phpapilaravelsdkrestHydraoauthOpenIdory

### Embed Badge

![Health badge](/badges/altelma-laravel-hydra/health.svg)

```
[![Health](https://phpackages.com/badges/altelma-laravel-hydra/health.svg)](https://phpackages.com/packages/altelma-laravel-hydra)
```

###  Alternatives

[xeroapi/xero-php-oauth2

Xero official PHP SDK for oAuth2 generated with OpenAPI spec 3

1054.3M14](/packages/xeroapi-xero-php-oauth2)[onesignal/onesignal-php-api

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

34170.2k2](/packages/onesignal-onesignal-php-api)[ory/hydra-client

Documentation for all of Ory Hydra's APIs.

17435.9k](/packages/ory-hydra-client)[zenditplatform/zendit-php-sdk

PHP client for Zendit API

1204.3k](/packages/zenditplatform-zendit-php-sdk)[abantecart/ups-php

UPS PHP SDK based on OAuth

1815.3k](/packages/abantecart-ups-php)[huaweicloud/huaweicloud-sdk-php

Huawei Cloud SDK for PHP

1829.2k2](/packages/huaweicloud-huaweicloud-sdk-php)

PHPackages © 2026

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