andrew1601/laravel-arbor

A minimal package to quickly use the Arbor Education API in a Laravel project

1.0.0 2024-05-18 15:01 UTC

This package is auto-updated.

Last update: 2025-02-18 22:54:52 UTC


README

A minimal package to enable quick integration of the Arbor Education API in a Laravel application. Currently it only supports the GraphQL API.

Installation

Install laravel-arbor with composer

  composer require andrew1601/laravel-arbor

Add your Arbor application's credentials to your .env file

ARBOR_URL=https://api-sandbox2.uk.arbor.sc
ARBOR_APP_USERNAME=
ARBOR_APP_PASSWORD=

Usage/Examples

You can use the ArborGraphQL facade to query with GraphQL. The facade is automatically registered for you when you install the package.

This facade returns the instance of Softonic\GraphQL\Client that was registered into your Laravel application and is pre-configured to query the GraphQL endpoint of the Arbor site entered in the ARBOR_URL variable of your .env file.

$query = <<<GQL
query {
    Student(currentlyEnrolled: true) {
        id
        displayName
    }
}
GQL;

$response = ArborGraphQL::query($query);

if ($response->hasErrors()) {
    // handle errors here
} else {
    $data = $response->getData();
}

For more information on performing queries, see the documentation for Softonic's GraphQL Client.

For information about the queries you can perform, see the documentation for Arbor Education's GraphQL API

Authors

Acknowledgements

License

MIT