bclibraries/libraryh3lp

Links to LibraryH3lp

1.0.0 2020-03-18 20:46 UTC

This package is auto-updated.

Last update: 2024-04-19 06:27:59 UTC


README

libraryh3lp is a PHP module for linking to the LibraryH3lp chat. For sites that have multiple queues, it determines the best available queue to link.

Installation

Use the composer package manager:

composer require bclibraries/libraryh3lp:^1.0

Usage

Minimal usage:

use BCLib\Libraryh3lp\Queue;
use BCLib\Libraryh3lp\Resolver;

// Build a resolver with the LibraryH3lp queues we use, in order of preference.
$resolver = new Resolver([
    new Queue('queue-1', 'Optimal Queue'),
    new Queue('queue-2', 'Second Best Queue'),
    new Queue('queue-3', 'Backup Queue')
]);

// Get the best LibraryH3lp queue URL...
$url = $resolver->resolve();

// ...or redirect to best LibraryH3lp queue.
$resolver->redirect();

Queue options

Queue constructors take the following arguments:

  • code - (string) the queue's LibraryH3lp ID code
  • title - (string) a human-readable title for the queue
  • skin - (string) a numeric LibraryH3lp skin code
  • sounds - (bool) enable sounds by default
$queue = new Queue('queue-code', 'Queue Title', '99999', true);

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT