sudiptochoudhury / php-ready-theatre-systems
PHP Client Library to consume Ready Theatre Systems, LLC – Open Interface API
Installs: 1 399
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 4
Forks: 4
Open Issues: 1
Requires
- php: ^7.1|^8.0
- sudiptochoudhury/php-api-client-forge: dev-master
Requires (Dev)
- mockery/mockery: ^1.1.0
- phpunit/phpunit: ^7.2.0
- psr/log: ^1.0@dev
- sudiptochoudhury/php-cli: dev-master
README
PHP API Client for Ready Theatre Systems, LLC – Open Interface API
use SudiptoChoudhury\Rts\Api; $rts = new Api([ 'theatre' => '<<theatre number>>' 'username' => '<<password>>', 'password' => '<<password>>', ]); $result = $rts->getShowTime(['ShowSales' => 1, 'ShowAvalTickets' => 1, 'ShowSaleLinks' => 1]); $result = $rts->checkIfSoldOut([ 'Data' => [ "Packet" => [ 'PerformanceID' => '018129000023' ] ] ]); $result = $rts->getGiftCardInformation([ 'Data' => [ "Packet" => [ 'GiftCards' => [ 'GiftCard' => '1234510813486422' ] ] ] ]);
Installation
Requirements
- Any flavour of PHP 7.1+ should do
Install With Composer
You can install the library via Composer by adding the following line to the require block of your composer.json file (replace dev-master with latest stable version):
"sudiptochoudhury/php-ready-theatre-systems": "dev-master"
or run the following command:
composer require sudiptochoudhury/php-ready-theatre-systems
Setting up
All you need to do is to pass theatre id, username and password to the constructor.
use SudiptoChoudhury\Rts\Api; new Api([ 'theatre' => '<<theatre number>>' 'username' => '<<password>>', 'password' => '<<password>>' ]);
Additionally, you can set a logger via log
property.
- You can set log to
false
to disable logging. - You can also pass an array with
file
andpath
properties.
use SudiptoChoudhury\Rts\Api; new Api([ 'theatre' => '<<theatre number>>' 'username' => '<<password>>', 'password' => '<<password>>', 'log' => ['file' => 'rts.log', 'path' => '/your/log/path'] ]);
- You can also pass a
Monolog\Logger
instance.
use SudiptoChoudhury\Rts\Api; new Api([ 'theatre' => '<<theatre number>>' 'username' => '<<password>>', 'password' => '<<password>>', 'log' => ['logger' => $monologInstance] ]);
You can use client
property to forward to GuzzleHttp\Client
constructor.
use SudiptoChoudhury\Rts\Api; new Api([ 'theatre' => '<<theatre number>>' 'username' => '<<password>>', 'password' => '<<password>>', 'client' => ['timeout' => 5] ]);
If you wish to tap into request and response handler stacks use settings
instead of using client
's handlers
property.
'settings' => [ 'responseHandler' => function (ResponseInterface $response) { // do something return $response; }, 'requestHandler' => function (RequestInterface $request) { // some action return $request; }, ],
How to use
Next, call the desired method from the table given below. In most methods you may need to pass parameters. The parameters are to be passed as an associative array.
Examples:
$rts = new Api([ 'theatre' => '<<theatre number>>' 'username' => '<<password>>', 'password' => '<<password>>', ]); $result = $rts->getShowTime(['ShowSales' => 1, 'ShowAvalTickets' => 1, 'ShowSaleLinks' => 1]); $result = $rts->checkIfSoldOut([ 'Data' => [ "Packet" => [ 'PerformanceID' => '018129000023' ] ] ]); $result = $rts->getGiftCardInformation([ 'Data' => [ "Packet" => [ 'GiftCards' => [ 'GiftCard' => '1234510813486422' ] ] ] ]);