soheilrt/laravel-adobe-connect-client

Adobe Connect Client Package For Laravel Based Applications

1.2.0 2021-05-01 07:56 UTC

This package is auto-updated.

Last update: 2024-10-27 13:47:26 UTC


README

Build Status Scrutinizer Code Quality

Intro

Laravel Adobe Connect provides a convenient way for Laravel applications to communicate with adobe connect API. This package is originally inspired by brunogasparetto's package but had some changes to provide more flexibility for developers while using this package!

Installation

You can install this package through packagist via the following command.

composer require soheilrt/laravel-adobe-connect-client

Minimum Requirements

  • PHP 7.2
  • PHP-CURL Extention
  • Adobe Connect API V9.4.5
  • Laravel 5.8

Quick Start

  1. Install the package via composer
composer require soheilrt/laravel-adobe-connect-client
  1. Set your adobe info inside .env file
ADOBE_CONNECT_HOST #your account host URL address with http:// OR https:// prefix
ADOBE_CONNECT_USER_NAME #your adobe connect account username
ADOBE_CONNECT_PASSWORD #your adobe connect account password

And you're all set :-).

You can also run following command to make sure everything work just fine

use Soheilrt\AdobeConnectClient\Facades\Client;
$commonInfo =Client::commonInfo();

Commands

All of the commands inside this package runs via the Client class.

All available commands are listed below:

Queries

There might be times that you want to filter(Sort) your data or results, you can do that via Filter and Sort Classes

Filtering Results

Here is an Example of how you can use Filter Class for commands that accepts Filtering

    /**
     * @param  \Soheilrt\AdobeConnectClient\Client\Client  $client
     *
     * @throws \Exception
     * @return array
     */
    public function exampleScoContents(\Soheilrt\AdobeConnectClient\Client\Client $client): array 
    {
        $folderId = 12345;

        $filter = Soheilrt\AdobeConnectClient\Client\Filter::instance()
            ->like('name', 'Test')
            ->dateAfter('dateBegin', new \DateTimeImmutable());

        return $client->scoContents($folderId, $filter);
    }

Sorting Results

Here is an example of how you can sort your query result on queries that accept Sorting

use Soheilrt\AdobeConnectClient\Client\Client;
use Soheilrt\AdobeConnectClient\Client\Filter;
use Soheilrt\AdobeConnectClient\Client\Sorter;

class ExampleClass
{
    /**
     * @param  Client  $client
     *
     * @throws \Exception
     * @return array 
     */
    public function exampleMethod(Client $client): array 
    {
        $folderId = 12345;

        $filter = Filter::instance()
            ->like('name', 'Test')
            ->dateAfter('dateBegin', new DateTimeImmutable());

        $sorter = Sorter::instance()
            ->asc('dateBegin');

        return $client->scoContents($folderId, $filter, $sorter);
    }
}

Advanced

Entities

You may sometimes want to change data on the fly! In this case you can do that with Accessor and mutators. You only need to extend base entity class (e.g: SCO Entity) and add your Accessor or Mutator to extended class and set your entity as primary entity inside package config file.

Here you can see an example of accessor which change description to uppercase on the fly!

#An Example of accessor 
Class ExtendedSco extends \Soheilrt\AdobeConnectClient\Facades\SCO
{
    public function getDescription()
    {
        return strtoupper($this->attributes['description']);
    }
}

and here is an example for mutator which manipulate data on the fly while trying to set properties inside entities.

class ExtendedSco extends \Soheilrt\AdobeConnectClient\Facades\SCO
{
    public function setDescription($value)
    {
        $this->attributes['description']=strtolower($value);
    }
}

Note: Entities Accessors Does Not support any arguments and Mutator are only support one arguments which accepts the data that user wants to set to the entity!

Publishing Configs

You may also want to publish config files to customize this package based on your needs.

php artisan vendor:publish --tag=adobe-connect

Mass assigment

Sometimes you want to assign mass of information to your entity. Here we made that possible with fill method just list eloquent models!

use \Soheilrt\AdobeConnectClient\Client\Entities\SCO;
$data=[
    'sco-id'=>1,
    'name'=>'new name'
];
$sco=SCO::instance()->fill($data);

Casting to array

If you ever want access to entities data at once, you can call toArray() command to access the whole entity data at the once.

Session Cache

By Default, we cache user session to prevent extra loggin request on every command but you can disable this feature if you prefer to manage your sessions manually

Note: we do not perform automatical login request if you disbale session cache and you should perform it manually.

Facades

we provided facades for entities in case you may someday change default entities to your custom entities and if you've used facades to accessing/instatiating instaces, you don't need to change anything inside your code because it'll handeled by adobe connect service provider and inject provided entity from config file.

Pending

  • Add Queue Support for Client Commands