PHPackages                             bgsu-lits/libcal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. bgsu-lits/libcal

ActiveLibrary[API Development](/categories/api)

bgsu-lits/libcal
================

SpringShare LibCal API Client.

v0.7.0(2y ago)5461[1 issues](https://github.com/BGSU-LITS/libcal/issues)[1 PRs](https://github.com/BGSU-LITS/libcal/pulls)MITPHPPHP ^7.4 | ^8.0

Since Jul 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/BGSU-LITS/libcal)[ Packagist](https://packagist.org/packages/bgsu-lits/libcal)[ RSS](/packages/bgsu-lits-libcal/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (15)Versions (12)Used By (0)

libcal
======

[](#libcal)

PHP client library for the [Springshare LibCal](https://springshare.com/libcal/) API.

Getting Started
---------------

[](#getting-started)

You may want to begin by reviewing the [Overview of the LibCal API](https://ask.springshare.com/libcal/faq/1407) from the Springshare Help Center. This client uses the API v1.1 endpoints.

This package is developed for [PHP 7.4 and above](https://www.php.net/supported-versions.php). You should use [Composer](https://getcomposer.org/) to install this package and its dependencies. For example:

```
php composer.phar require bgsu-lits/libcal guzzlehttp/guzzle guzzlehttp/psr7 desarrolla2/cache

```

### Required Dependencies

[](#required-dependencies)

#### [PSR-18 HTTP Client](https://www.php-fig.org/psr/psr-18/)

[](#psr-18-http-client)

The client requires an [implementation of `psr/http-client`](https://packagist.org/providers/psr/http-client-implementation). This documentation will use [`guzzlephp/guzzle`](https://packagist.org/packages/guzzlehttp/guzzle) for examples, but any implementation may be used instead.

#### [PSR-17 HTTP Factories](https://www.php-fig.org/psr/psr-17/)

[](#psr-17-http-factories)

The client requires an [implementation of `psr/http-factory`](https://packagist.org/providers/psr/http-factory-implementation). This documentation will use [`guzzlephp/psr7`](https://packagist.org/packages/guzzlehttp/psr7) for examples, but any implementation may be used instead.

#### [PSR-7 HTTP Message Interface](https://www.php-fig.org/psr/psr-7/)

[](#psr-7-http-message-interface)

The client requires an [implementation of `psr/http-message`](https://packagist.org/providers/psr/http-message-implementation). This documentation will use [`guzzlephp/psr7`](https://packagist.org/packages/guzzlehttp/psr7) for examples, but any implementation may be used instead.

### Optional Dependencies

[](#optional-dependencies)

#### [PSR-16 Simple Cache](https://www.php-fig.org/psr/psr-16/)

[](#psr-16-simple-cache)

The client can use an [implementation of `psr/simple-cache`](https://packagist.org/providers/psr/simple-cache-implementation). This documentation will use [`desarrolla2/cache`](https://packagist.org/packages/desarrolla2/cache) for examples, but any implementation may be used instead.

Determining Client Credentials
------------------------------

[](#determining-client-credentials)

### Host

[](#host)

The host for the client will be the hostname of your LibCal instance, i.e. `.libcal.com`. For examples, we'll use BGSU's host of `bgsu.libcal.com`.

### Client ID and Secret

[](#client-id-and-secret)

Visit the Dashboard of your LibCal instance, and navigate to Admin &gt; API. Choose the API Authentication tab, and use the Create New Application button under the Applications section. You may specify any Application Name and Description you prefer and leave checked any of the scopes you want to access with the client.

Once you've created the application, you will need to copy the values from the Client Id and Client Secret columns of the Applications table. For examples, we'll use a Client ID of `100` and a Client Secret of `61483dcf150d97c921abbe1f8024eb2e`.

Instantiating the API Client
----------------------------

[](#instantiating-the-api-client)

Now that you've gathered the dependencies and credentials, you can instantiate the API client. Below is an example PHP file that will include Composer's autoloader and create the API client with credentials and dependencies. This is using the examples we've specified above, with comments showing the interfaces the dependencies must implement.

```
