Download the PHP package spinen/laravel-discourse-sso without Composer

On this page you can find all versions of the php package spinen/laravel-discourse-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 laravel-discourse-sso

SPINEN's Discourse SSO for Laravel

Latest Stable Version Latest Unstable Version Total Downloads License

Discourse is a great online forum software that supports Single Sign On (SSO). There is a great PHP library that handles all of the heavy lifting to make the SSO work called cviebrock/discourse-php, which this package uses. This package is loosely based on the work done by jaewun/discourse-sso-laravel.

Build Status

Branch Status Coverage Code Quality
Develop Build Status Code Coverage Scrutinizer Code Quality
Master Build Status Code Coverage Scrutinizer Code Quality

Prerequisite

NOTE: If you need to use < PHP 7.2, please stay with version 1.x

Aside from Laravel >= 5.5, there is 1 package that is required.

Install

Install Discourse SSO for Laravel:

The package uses the auto registration feature of Laravel 5.

Package Configuration

All of the configuration values are stored in under a discourse key in config/services.php. Here is the array to add...

The value of the properties for the user property can be one of 4 values...

  1. false -- passed as set to Discourse
  2. true -- passed as set to Discourse
  3. null -- disables sending property to Discourse
  4. a string -- name of a property on the User model

You can then add logic to the User model inside of Accessors to provide the values for the properties configured for the user. For example, if you wanted any user with an email address that matched "yourdomain.tld" to be a moderator, then you could set the moderator property to a string like discourse_moderator and add the following to your User model...

Discourse Configuration

Settings -> Login

These are the configs we have under Settings -> Login. If a setting isn't listed, then ours is set to the default value.

Setting Value
login required true
enable sso true
sso url Our Laravel's SSO route (FQDN)
sso secret Our SSO secret key
sso overrides bio true
sso overrides email true
sso overrides username true
sso overrides name true
sso overrides avatar true
sso not approved url Our Laravel homepage (same as url in config/app.php)
hide email address taken true

Settings -> Users

These are the configs we have under Settings -> Users. If a setting isn't listed, then ours is set to the default value.

Setting Value
reserved usernames We added our client's company name
min password length 8
min admin password length 8
email editable false
logout redirect Our Laravel homepage (same as url in config/app.php)
purge unactivated users grace period days 30
hide user profiles from public true

Logging out the Discourse User

There's a listener in src/Listeners/LogoutDiscourseUser.php that will automatically log out the user from Discourse when certain events are fired. To use the Listener, you need to register the event in the $listen array in your EventServiceProvider.

When a Laravel User logs out, to log out their Discourse session Simply add the Laravel Logout event & the LogoutDiscourseUser listener in that $listen array. If you want to log out Discourse users on a Laravel User being deleted or disabled, make your own event class and register it the same way.

Example

Laravel 11

In Laravel 11, the use of the EventServiceProvider is discouraged and events should be registered in the AppServiceProvider.

Therefore, the implementation is slightly different, and it should be registered within the boot method of the AppServiceProvider as per the example below.

Left to do


All versions of laravel-discourse-sso with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
cviebrock/discourse-php Version ^0.9.3
guzzlehttp/guzzle Version ^7.4.5
illuminate/auth Version ~8|~9|~10|~11
illuminate/routing Version ~8|~9|~10|~11
illuminate/support Version ~8|~9|~10|~11
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 spinen/laravel-discourse-sso contains the following files

Loading the files please wait ....