epierce/cas-rest-client

This package is abandoned and no longer maintained. No replacement package was suggested.

PHP client for the CAS REST protocol.

0.3.1 2016-02-05 20:05 UTC

This package is not auto-updated.

Last update: 2023-01-18 05:51:38 UTC


README

PHP client for the CAS REST protocol

System Requirements

You need:

  • PHP >= 5.5.0, but the latest stable version of PHP is recommended
  • Composer

Install

Install cas-rest-client using Composer.

$ composer require epierce/cas-rest-client

Example Usage

<?php

use epierce\CasRestClient;

require_once('vendor/autoload.php');

$client = new CasRestClient();

// Configure CAS client
$client->setCasServer('https://cas.exmaple.edu');
$client->setCasRestContext('/v1/tickets');
$client->setCredentials("username", "password");

// Login and save TGT to a file
$client->login('/tmp/cas_tgt.json');

// Make a webservice call
$response = $client->get("https://someservice");
print_r(json_decode($response->getBody(), true));

// Make another call using the same CAS session
$headers = ['User-Agent' => 'testing/1.0'];
$post_params = ['param1' => 'foo', param2 => 'bar'];
$response = $client->post("https://someotherservice", $headers, '', $post_params);
print_r(json_decode($response->getBody(), true));

$client->logout();

?>