PHPackages                             garlic/auth - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. garlic/auth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

garlic/auth
===========

JWT token authorization for Garlic services

1.1.2(6y ago)03.4k1MITPHP

Since Jan 16Pushed 6y ago7 watchersCompare

[ Source](https://github.com/garlicservices/auth-bundle)[ Packagist](https://packagist.org/packages/garlic/auth)[ RSS](/packages/garlic-auth/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (3)Versions (8)Used By (0)

Garlic Authorization bundle
===========================

[](#garlic-authorization-bundle)

JWT token authorization bundle
------------------------------

[](#jwt-token-authorization-bundle)

### Installation

[](#installation)

#### 1. Run:

[](#1-run)

```
$ composer require garlic/auth
```

#### 2. Add to .env.dist (.env):

[](#2-add-to-envdist-env)

```
# Required
JWT_PUBLIC_KEY_PATH='config/jwt/public.pem'

# Optional
JWT_PRIVATE_KEY_PATH=''
JWT_KEY_PASS_PHRASE='passPhrase'
JWT_TOKEN_TTL='3600'
JWT_USER_IDENTITY_FIELD='email'
JWT_USER_CLASS='Garlic\Auth\Security\User'

# User auth settings
USER_ADMIN_USERNAME=admin
USER_ADMIN_PASSWORD=securePassword
USER_SERVICE_NAME=users
```

#### 3. Add Security configuration (change packages/security.yml):

[](#3-add-security-configuration-change-packagessecurityyml)

```
security:
    providers:
        jwt_provider:
            lexik_jwt:
                class: Garlic\Auth\Security\User
    firewalls:
        main:
            pattern:   ^/
            stateless: true
            anonymous: true
            guard:
                authenticators:
                    - lexik_jwt_authentication.jwt_token_authenticator
```

#### 4. Add Lexik jwt bundle configuration (change lexik\_jwt\_authentication.yml):

[](#4-add-lexik-jwt-bundle-configuration-change-lexik_jwt_authenticationyml)

```
lexik_jwt_authentication:
    private_key_path: '%kernel.project_dir%/%env(JWT_PRIVATE_KEY_PATH)%'
    public_key_path:  '%kernel.project_dir%/%env(JWT_PUBLIC_KEY_PATH)%'
    pass_phrase:      '%env(JWT_PASSPHRASE)%'
    token_ttl:        '%env(JWT_TOKEN_TTL)%'
    user_identity_field: email
    encoder:
        service: lexik_jwt_authentication.encoder.lcobucci
        crypto_engine:  openssl
        signature_algorithm: RS384
    token_extractors:
        authorization_header:
            enabled: true
            prefix:  ''
            name:    Authorization
```

### Using

[](#using)

#### 1. Make JWT token from the authorization service

[](#1-make-jwt-token-from-the-authorization-service)

#### 2. Add JWT token to to request headers:

[](#2-add-jwt-token-to-to-request-headers)

Example:

```
Authorization: Body.Of.Token
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

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

Recently: every ~132 days

Total

7

Last Release

2503d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/911fb3b905a102069ad8345c1ccb6547636e7fafc75b4da58213d3fe679be486?d=identicon)[garlic](/maintainers/garlic)

---

Top Contributors

[![imaximius](https://avatars.githubusercontent.com/u/5578878?v=4)](https://github.com/imaximius "imaximius (1 commits)")

---

Tags

composer-packagesymfony-bundle

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/garlic-auth/health.svg)

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

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[league/oauth2-server

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

6.6k136.0M248](/packages/league-oauth2-server)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[kreait/firebase-tokens

A library to work with Firebase tokens

24040.8M14](/packages/kreait-firebase-tokens)[scheb/2fa

Two-factor authentication for Symfony applications (please use scheb/2fa-bundle to install)

578630.7k1](/packages/scheb-2fa)

PHPackages © 2026

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