Download the PHP package zhylon/zhylon-auth without Composer

On this page you can find all versions of the php package zhylon/zhylon-auth. 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 zhylon-auth

Zhylon OAuth2

Zhylon OAuth2 Provider for Laravel Socialite

Integrate ZhylonID single sign-on into your Laravel application with just a few lines of code. This package provides a first-class Laravel Socialite driver for the Zhylon OAuth2 service, handling the full authentication flow, token management, and user synchronization out of the box.

Latest Version on Packagist Total Downloads


📋 Table of Contents


✨ Features


📦 Requirements

Dependency Version
PHP ^8.3
Laravel ^10.0 \| ^11.0 \| ^12.0
Laravel Socialite ^5.0

Note: You need an active ZhylonID account and a registered OAuth application. Sign up at https://id.zhylon.net.


🚀 Installation

Install the package via Composer:

Publish the configuration file and migration:

Run the database migration to add the required columns to your users table:


⚙️ Configuration

Environment Variables

Add the following variables to your .env file. You will find the client credentials in your ZhylonID dashboard after registering your application.

Optional settings — these have sensible defaults but can be customized:

Config File

After publishing, the config file is available at config/zhylon-auth.php. This file maps the environment variables above and can be adjusted for more advanced setups (e.g., per-environment overrides).


👤 Preparing Your User Model

The package syncs OAuth user data into your User model. You need to add the three Zhylon fields to the $fillable array so that mass-assignment works correctly:

The migration published in the previous step will automatically add these three columns to your users table:

Column Type Description
zhylon_id string\|null Unique user ID from ZhylonID
zhylon_token text\|null Current OAuth access token
zhylon_refresh_token text\|null OAuth refresh token for re-authentication

🧑‍💻 Usage

OAuth Flow Overview

The package implements the standard OAuth2 Authorization Code flow:

Controller Example

The package registers the redirect and callback routes automatically. If you need to build a custom controller or override the default behavior, here is a full example:

Register the routes in routes/web.php:

Accessing User Data

Once the user is authenticated, you can access the Zhylon-specific fields directly from the authenticated user:

Token Refresh

If you need to refresh an expired access token on behalf of a user, you can use Socialite's refreshToken method:

Note: ZhylonID may rotate refresh tokens on use. Always persist the new refresh token returned from this call.


📄 Environment Variables Reference

Variable Required Default Description
ZHYLON_AUTH_CLIENT_ID Your OAuth application's client ID
ZHYLON_AUTH_CLIENT_SECRET Your OAuth application's client secret
ZHYLON_AUTH_CALLBACK_WEBSITE config('app.url') Base URL of your application (no trailing slash)
ZHYLON_AUTH_SITE_PATH /auth/zhylon Path for the OAuth redirect route
ZHYLON_AUTH_BASE_URI https://id.zhylon.net ZhylonID OAuth server base URL
ZHYLON_AUTH_HOME /dashboard Redirect destination after successful login

🔧 Troubleshooting

InvalidStateException after callback This typically happens when the session is lost between the redirect and the callback. Make sure your session middleware is applied to the callback route and that your session driver is properly configured.

Client error: 401 Unauthorized Double-check that ZHYLON_AUTH_CLIENT_ID and ZHYLON_AUTH_CLIENT_SECRET in your .env match the credentials in your ZhylonID dashboard. Also clear the config cache: php artisan config:clear.

Callback URL mismatch The callback URL registered in your ZhylonID application must exactly match the value of ZHYLON_AUTH_CALLBACK_WEBSITE + ZHYLON_AUTH_SITE_PATH + /callback. For example: https://your-app.com/auth/zhylon/callback.

Columns not found after migration If the migration did not run, execute php artisan migrate. If the columns are missing from the migration file, re-publish with: php artisan vendor:publish --force.


📝 Changelog

Please see CHANGELOG for a full history of changes.


🤝 Contributing

Contributions are welcome! Please read the Contributing Guide before submitting a pull request.

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin feature/my-new-feature
  5. Open a Pull Request

🔒 Security


🙏 Credits


📄 License

The MIT License (MIT). Please see the License File for details.


All versions of zhylon-auth with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3|^8.4|8.5
ext-json Version *
laravel/socialite Version ^5.24
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 zhylon/zhylon-auth contains the following files

Loading the files please wait ...