Download the PHP package ph-ab/keycloak-sso without Composer

On this page you can find all versions of the php package ph-ab/keycloak-sso. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package keycloak-sso

keycloak-sso

A small, reusable Keycloak SSO login service for Laravel. Drop it into any project to authenticate users against Keycloak with the OpenID Connect Resource Owner Password grant — token exchange, userinfo, refresh, and logout — with clean, typed error handling.

Extracted from the PH AB API so every project shares one battle-tested SSO implementation instead of copy-pasting the controller logic.

Features

Requirements

Installation

The service provider and KeycloakSso facade are auto-discovered. Publish the config file if you want to edit it:

Configuration

Set credentials in .env. The active connection is picked by app()->environment(), falling back to the default connection.

Usage

Other operations:

Optional: DB-password fallback

When Keycloak positively rejects a credential, the manager can ask your app to verify it locally (handy while migrating users into Keycloak). Point the fallback config at an invokable class:

You can also set it at runtime: KeycloakSso::fallbackUsing(fn ($u, $p) => ...).

Load credentials from the database (or anywhere)

The package never touches your database schema. When you want credentials to come from a DB table (or an API, a secrets manager, …), you provide the query and the package just calls it. Pick whichever style you prefer.

No migration, no table, no column config. Your schema stays entirely yours.

Option A — a callback (quickest)

Set the resolver to CallbackConnectionResolver and write your query under credentials. It receives the environment and returns the four values:

That's the whole integration — KeycloakSso::login() now reads from your table. The callback may also return a ConnectionConfig directly.

Priority: by default .env wins — the env-driven connections are used first, and your credentials callback only fills in what .env is missing. This is safe for gradual migration and local overrides. Leave credentials null and .env is used exactly as before.

Want the callback (DB) to win instead? Set credentials_priority => true. Then your query is used first and .env becomes the fallback.

Either way, the same resolver covers both sources — no need to switch resolver back and forth.

If you use php artisan config:cache, point credentials at an invokable class name instead of a closure (closures can't be cached):

Option B — a full resolver class (most control)

For caching, decryption, fallbacks, or anything custom, implement ConfigResolver yourself and point resolver at it:

Both options are validated by ConnectionConfig::fromArray(), so a missing value fails loudly instead of silently logging in against a broken config.

Publishing to Packagist

  1. Push this directory to its own public Git repository.
  2. Tag a release: git tag v1.0.0 && git push --tags.
  3. Submit the repo URL at https://packagist.org/packages/submit and enable the GitHub/Bitbucket hook so new tags auto-update.

The package contains no secrets — all credentials come from the consuming app's .env or config — so it is safe to publish publicly.

License

MIT


All versions of keycloak-sso with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ph-ab/keycloak-sso contains the following files

Loading the files please wait ...