Skip to content

christopher-b/canvas-client-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

canvas-client-php

A Canvas LMS API client for PHP. Requires Zend Framework >= v1.12 Very incomplete.

Configuration & Setup

Files should go in your application's library folder, alongside the Zend folder.

myapp/
    application/
    library/
        Zend/
        OCAD/

This package assumes you're using the Zend Autoloader. You will need to add the OCAD namespace to your autoloader:

$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('OCAD_');
// Or, in application.ini: 
autoloaderNamespaces.ocad = "OCAD_"

In your bootstrap, do:

OCAD_Canvas_Client::$apiConfig = array(
	'defaultAccount' = 1,
	'url' 		 = "https://my.canvas.com/",
	'apiKey' 	 = "{my api key}",
);

(This could also go in your application.ini config, and added as a bootstrap resource)

Usage

$courseId = <canvas course id or "sis id">; 
$course = OCAD_Canvas_Course::load($courseId);
$course->getStudents();
$course->getGrades();
$course->publish();

$userId = <canvas user id or "sis id">;
$user = OCAD_Canvas_User::load($userId);
$user->getTodos();
$user->getActivityStream();
$user->getCourses();

$grade = $course->getGradeForStudent($user);
$grade->grade;

About

A Canvas LMS API client for PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages