majuto/laravel-jasper

This package lets you use the Jasper REST Client library in Laravel

v0.1.1 2019-04-29 13:12 UTC

This package is auto-updated.

Last update: 2024-03-29 03:38:52 UTC


README

This package lets you use the Zend LDAP library in Laravel

Installation

Package
composer require majuto/laravel-jasper
Config
php artisan vendor:publish
return [
    'default' => 'jasper',

    'jasper' => [
        "host" => env('JASPER_HOST', "jasper.local"),
        "username" => env('JASPER_USERNAME', "username"),
        "password" => env('JASPER_PASSWORD', "password"),
        "organisationId" => env('JASPER_ORG_ID', null),
    ]
];

If you need to manage multiple jasper servers, you can add new config keys :

return [
    'default' => 'prod',

    'prod' => [
        "host" => env('JASPER_HOST', "jasper.local"),
        "username" => env('JASPER_USERNAME', "username"),
        "password" => env('JASPER_PASSWORD', "password"),
        "organisationId" => env('JASPER_ORG_ID', null),
    ],
    'test' => [
        "host" => env('JASPER_HOST', "jasper-test.local"),
        "username" => env('JASPER_USERNAME', "username"),
        "password" => env('JASPER_PASSWORD', "password"),
        "organisationId" => env('JASPER_ORG_ID', null),
    ]
];

Usage

Once installed, you have access to the jasper() helper which returns an instance of Jasper class, extending the original Client class. You have access to all of the original methods and some that have been added to simplify some uses, especially for users management.

  • jasper(): Returns the Jasper object with the "default" configuration ("prod" in example).
  • jasper('test'): Returns the Jasper object with the "test" configuration.
  • jasper()->searchUsers($query): Returns an array with all users matching $query (all if $query is an empty string).
  • jasper()->getUser($username): Returns the User with username = $username.
  • jasper()->addOrUpdateUser($user): Add or update the User $user.