Documentation

Course extends AbstractBaseApi
in package

Course Class

Represents a course in the Canvas LMS. This class provides methods to create, update, find, and fetch multiple courses from the Canvas LMS system. It utilizes Data Transfer Objects (DTOs) for handling course creation and updates.

Usage:

// Creating a new course
$courseData = [
    'name' => 'Introduction to Philosophy',
    'courseCode' => 'PHIL101',
    // ... other course data ...
];
$course = Course::create($courseData);

// Updating an existing course statically
$updatedData = [
    'name' => 'Advanced Philosophy',
    'courseCode' => 'PHIL201',
    // ... other updated data ...
];
$updatedCourse = Course::update(123, $updatedData); // where 123 is the course ID

// Updating an existing course instance
$course->name = 'Advanced Philosophy';
$course->save();

// Finding a course by ID
$course = Course::find(123);

// Get first page of courses (memory efficient)
$courses = Course::get();
$courses = Course::get(['per_page' => 50]); // Custom page size

// Get ALL courses from all pages (⚠️ Be cautious with large datasets)
$allCourses = Course::all();

// Get paginated results with metadata (recommended for large datasets)
$paginated = Course::paginate(['per_page' => 50]);
echo "Page {$paginated->getCurrentPage()} of {$paginated->getTotalPages()}";
echo "Total courses: {$paginated->getTotalCount()}";

// Process next page
if ($paginated->hasNextPage()) {
    $nextPage = $paginated->getNextPage();
}

Table of Contents

Properties

$accessRestrictedByDate  : bool
$accountId  : int
$allowStudentAssignmentEdits  : bool
$allowStudentForumAttachments  : bool
$allowWikiComments  : bool
$applyAssignmentGroupWeights  : bool
$bannerImageId  : int|null
Optional: Course banner image ID for Canvas for Elementary
$bannerImageUrl  : string|null
Optional: Course banner image URL for Canvas for Elementary
$blueprint  : bool
$blueprintRestrictions  : array<string|int, mixed>|null
$blueprintRestrictionsByObjectType  : array<string|int, mixed>|null
$calendar  : CalendarLink|null
$concluded  : bool|null
Optional: Whether course is concluded (computed field)
$conditionalRelease  : bool
Conditional release (individual learning paths) enabled
$courseCode  : string
$courseColor  : string|null
Optional: Course color in hex format for Canvas for Elementary
$courseFormat  : string
$courseProgress  : CourseProgress|null
$createdAt  : string
$defaultDueTime  : string
Default due time for assignments (HH:MM:SS format)
$defaultView  : string
$enableCoursePaces  : bool
Course pacing enabled flag
$endAt  : string|null
$enrollments  : array<string|int, mixed>|null
$enrollmentTermId  : int|null
$friendlyName  : string|null
Optional: Course friendly name for Canvas for Elementary
$gradePassbackSetting  : string|null
$gradingPeriods  : array<string|int, mixed>|null
$gradingStandardId  : int|null
$hideFinalGrades  : bool
$homeroomCourse  : bool
Optional: Sets the course as a homeroom course
$id  : int
The unique identifier for the course
$imageId  : int|null
Optional: Course image ID if set
$imageUrl  : string|null
Optional: Course image URL if set
$integrationId  : string|null
$isPublic  : bool
$isPublicToAuthUsers  : bool
$license  : string|null
$locale  : string|null
$ltiContextId  : string|null
Optional: LTI context ID for the course
$name  : string
$needsGradingCount  : int|null
$openEnrollment  : bool
$originalName  : string|null
$permissions  : array<string|int, mixed>|null
$postManually  : bool|null
Optional: Whether grades are posted manually or automatically
$publicDescription  : string|null
$publicSyllabus  : bool
$publicSyllabusToAuth  : bool
$restrictEnrollmentsToCourseDates  : bool
$rootAccountId  : int
$selfEnrollment  : bool
$sisCourseId  : string|null
The SIS identifier for the course, if defined. This field is only included if the user has permission to view SIS information.
$sisImportId  : int|null
The integration identifier for the course, if defined. This field is only included if the user has permission to view SIS information.
$startAt  : string|null
$storageQuotaMb  : int
$storageQuotaUsedMb  : int
$syllabusBody  : string|null
$syllabusCoursesSummary  : bool
Syllabus course summary enabled (for syllabus page)
$template  : bool
$term  : Term|null
$timeZone  : string
$totalStudents  : int|null
$useBlueprintRestrictionsByObjectType  : bool
Whether the course uses blueprint restrictions by object type
$uuid  : string
The UUID of the course
$workflowState  : string
$apiClient  : HttpClientInterface
$methodAliases  : array<string|int, mixed>
Define method aliases

Methods

__callStatic()  : mixed
Magic method to handle function aliases
__construct()  : mixed
Constructor
all()  : array<string|int, static>
Get all pages of results
analytics()  : array<int, array<string, mixed>>
Get analytics data for this course
announcements()  : array<string|int, Announcement>
Get announcements for this course
assignmentAnalytics()  : array<int, array<string, mixed>>
Get assignment analytics for this course
assignments()  : array<string|int, Assignment>
Get assignments for this course
batchUpdate()  : array<string|int, mixed>
Batch update multiple courses
calendarEvents()  : array<string|int, CalendarEvent>
Get calendar events for this course
conclude()  : self
Conclude the course in the Canvas LMS system
conferences()  : array<string|int, Conference>
Get conferences for this course.
contentMigration()  : ContentMigration
Get a specific content migration for this course
contentMigrations()  : array<string|int, ContentMigration>
Get content migrations for this course
copyContentFrom()  : ContentMigration
Copy content from another course
copyCourseContent()  : array<string|int, mixed>
Copy course content DEPRECATED: Use Content Migrations API instead Copies content from one course into another
copyWithDateShift()  : ContentMigration
Copy content with date shifting
create()  : self
Create a new Course instance
createCalendarEvent()  : CalendarEvent
Create a calendar event for this course
createConference()  : Conference
Create a conference for this course.
createContentMigration()  : ContentMigration
Create a content migration for this course
createFile()  : array<string|int, mixed>
Create a file upload to the course This API endpoint is the first step in uploading a file to a course
createGroupCategory()  : GroupCategory
Create a group category in this course
createOutcome()  : OutcomeLink
Create a new outcome directly in this course.
createReport()  : CourseReports
Start generating a new report for this course
delete()  : self
Delete the course from the Canvas LMS system
discussionTopics()  : array<string|int, DiscussionTopic>
Get discussion topics for this course
dismissQuizMigrationAlert()  : array<string|int, mixed>
Remove quiz migration alert Remove alert about quiz migration limitations displayed to user
enrollments()  : array<string|int, Enrollment>
Get enrollments for this course (relationship method alias with parameter support)
externalTools()  : array<string|int, ExternalTool>
Get external tools for this course
featureFlag()  : FeatureFlag
Get a specific feature flag for this course.
featureFlags()  : array<int, FeatureFlag>
Get all feature flags for this course.
files()  : array<string|int, File>
Get files for this course
find()  : self
Find a course by ID
get()  : array<string|int, Course>
Fetch all courses
getAccountId()  : int
getActiveEnrollments()  : array<string|int, Enrollment>
Get active enrollments for this course
getActivityStream()  : array<string|int, mixed>
Get current user's course-specific activity stream
getActivityStreamSummary()  : array<string|int, mixed>
Get current user's course-specific activity stream summary
getBannerImageId()  : int|null
getBannerImageUrl()  : string|null
getBlueprintRestrictions()  : array<string|int, mixed>|null
getBlueprintRestrictionsByObjectType()  : array<string|int, mixed>|null
getBulkUserProgress()  : array<string|int, mixed>
Get bulk user progress for all users in this course
getCalendar()  : CalendarLink|null
getCourseCode()  : string
getCourseColor()  : string|null
getCourseCopyStatus()  : array<string|int, mixed>
Get course copy status DEPRECATED: Use Content Migrations API instead Retrieve the status of a course copy operation
getCourseFormat()  : string
getCourseProgress()  : CourseProgress|null
getCreatedAt()  : string
getDefaultDueTime()  : string
getDefaultView()  : string
getDesignerEnrollments()  : array<string|int, Enrollment>
Get designer enrollments for this course
getEffectiveDueDates()  : array<string|int, mixed>
Get effective due dates for assignments in this course
getEndAt()  : string|null
getEnrollments()  : array<string|int, mixed>|null
getEnrollmentsData()  : array<string|int, mixed>|null
Get the course's enrollment data array (legacy method - uses embedded data)
getEnrollmentTermId()  : int|null
getFriendlyName()  : string|null
getGradebookHistoryDays()  : array<string|int, GradebookHistoryDay>
Get days with grading activity in this course.
getGradebookHistoryForDay()  : array<string|int, GradebookHistoryGrader>
Get graders who had activity on a specific day.
getGradePassbackSetting()  : string|null
getGradingPeriods()  : array<string|int, mixed>|null
getGradingStandardId()  : int|null
getId()  : int
getImageId()  : int|null
getImageUrl()  : string|null
getIntegrationId()  : string|null
getLastReport()  : CourseReports
Get the status of the last report of the specified type for this course
getLicense()  : string|null
getLocale()  : string|null
getLtiContextId()  : string|null
getName()  : string
getNeedsGradingCount()  : int|null
getObserverEnrollments()  : array<string|int, Enrollment>
Get observer enrollments for this course
getOriginalName()  : string|null
getPermissions()  : array<string|int, mixed>|null
getPublicDescription()  : string|null
getRecentStudents()  : array<string|int, mixed>
Get recently logged in students in this course
getReport()  : CourseReports
Get the status of a specific report for this course
getRootAccountId()  : int
getSettings()  : array<string|int, mixed>
Get course settings
getSisCourseId()  : string|null
getSisImportId()  : int|null
getStartAt()  : string|null
getStorageQuotaMb()  : int
getStorageQuotaUsedMb()  : int
getStudentCount()  : int
Get the count of student enrollments in this course
getStudentEnrollments()  : array<string|int, Enrollment>
Get student enrollments for this course
getStudents()  : array<string|int, mixed>
Get students in this course (legacy method - use getUsers with enrollment_type filter instead)
getSyllabusBody()  : string|null
getTaEnrollments()  : array<string|int, Enrollment>
Get TA enrollments for this course
getTeacherCount()  : int
Get the count of teacher enrollments in this course
getTeacherEnrollments()  : array<string|int, Enrollment>
Get teacher enrollments for this course
getTerm()  : Term|null
getTestStudent()  : array<string|int, mixed>
Get or create a test student for this course
getTimetable()  : array<string, mixed>
Get course timetable
getTimeZone()  : string
getTodoItems()  : array<string|int, mixed>
Get current user's course-specific TODO items
getTotalEnrollmentCount()  : int
Get the count of total enrollments in this course
getTotalStudents()  : int|null
getUser()  : array<string|int, mixed>
Get a single user in this course
getUserProgress()  : array<string|int, mixed>
Get user progress in this course
getUsers()  : array<string|int, mixed>
List users in this course with optional filtering
getUuid()  : string
getWorkflowState()  : string
gradebookHistory()  : GradebookHistory
Get a GradebookHistory instance configured for this course.
groupCategories()  : array<string|int, GroupCategory>
Get group categories in this course
groupCategoriesPaginated()  : PaginatedResponse
Get paginated group categories in this course
groups()  : array<string|int, Group>
Get groups in this course
groupsPaginated()  : PaginatedResponse
Get paginated groups in this course
hasStudentEnrolled()  : bool
Check if a specific user is a student in this course
hasTeacherEnrolled()  : bool
Check if a specific user is a teacher in this course
hasUserEnrolled()  : bool
Check if a specific user is enrolled in this course
importCommonCartridge()  : ContentMigration
Import content from a Common Cartridge file
importOutcomes()  : OutcomeImport
Import outcomes to this course from a CSV file
importOutcomesFromData()  : OutcomeImport
Import outcomes to this course from CSV data
importZipFile()  : ContentMigration
Import content from a ZIP file
isAccessRestrictedByDate()  : bool
isAllowStudentAssignmentEdits()  : bool
isAllowStudentForumAttachments()  : bool
isAllowWikiComments()  : bool
isApplyAssignmentGroupWeights()  : bool
isBlueprint()  : bool
isConcluded()  : bool|null
isConditionalRelease()  : bool
isEnableCoursePaces()  : bool
isHideFinalGrades()  : bool
isHomeroomCourse()  : bool
isOpenEnrollment()  : bool
isPostManually()  : bool|null
isPublic()  : bool
isPublicSyllabus()  : bool
isPublicSyllabusToAuth()  : bool
isPublicToAuthUsers()  : bool
isRestrictEnrollmentsToCourseDates()  : bool
isSelfEnrollment()  : bool
isSyllabusCoursesSummary()  : bool
isTemplate()  : bool
isUseBlueprintRestrictionsByObjectType()  : bool
linkOutcome()  : OutcomeLink
Link an existing outcome to this course.
mediaAttachments()  : array<string|int, MediaObject>
Get media attachments for this course
mediaObjects()  : array<string|int, MediaObject>
Get media objects for this course
modules()  : array<string|int, Module>
Get modules for this course
outcomeGroups()  : array<int, OutcomeGroup>
Get outcome groups for this course
outcomeImportStatus()  : OutcomeImport
Get outcome import status for this course
outcomeLinks()  : array<int, OutcomeLink>
Get all outcome links for this course (across all groups).
outcomeResults()  : array<int, OutcomeResult>
Get outcome results for this course
outcomeRollups()  : array<string, mixed>
Fetch outcome rollups for this course.
outcomeRollupsAggregate()  : array<string, mixed>
Fetch course aggregate outcome rollup.
outcomeRollupsExportCSV()  : string
Export outcome rollups to CSV for this course.
outcomes()  : array<int, OutcomeLink>
Get outcomes for this course.
pages()  : array<string|int, Page>
Get pages for this course
paginate()  : PaginationResult
Get paginated results with metadata
paginateRaw()  : PaginatedResponse
Fetch courses with pagination support
permissions()  : array<string|int, mixed>
Get permissions for the current user in this course (relationship method)
previewHtml()  : array<string|int, mixed>
Preview HTML content processed for this course
quizzes()  : array<string|int, Quiz>
Get quizzes for this course
removeFeatureFlag()  : bool
Remove a feature flag for this course.
reset()  : self
Deletes the current course, and creates a new equivalent course with no content, but all sections and users moved over
rubrics()  : array<string|int, Rubric>
Get rubrics for this course
save()  : self
Save the course to the Canvas LMS system
searchContentShareUsers()  : array<string|int, mixed>
Search for content share users in this course
sections()  : array<string|int, Section>
Get sections for this course
selectiveCopyFrom()  : ContentMigration
Create a selective course copy
setAccessRestrictedByDate()  : void
setAccountId()  : void
setAllowStudentAssignmentEdits()  : void
setAllowStudentForumAttachments()  : void
setAllowWikiComments()  : void
setApiClient()  : void
Set the API client
setApplyAssignmentGroupWeights()  : void
setBannerImageId()  : void
setBannerImageUrl()  : void
setBlueprint()  : void
setBlueprintRestrictions()  : void
setBlueprintRestrictionsByObjectType()  : void
setCalendar()  : void
setConcluded()  : void
setConditionalRelease()  : void
setCourseCode()  : void
setCourseColor()  : void
setCourseFormat()  : void
setCourseProgress()  : void
setCreatedAt()  : void
setDefaultDueTime()  : void
setDefaultView()  : void
setEnableCoursePaces()  : void
setEndAt()  : void
setEnrollments()  : void
setEnrollmentTermId()  : void
setFeatureFlag()  : FeatureFlag
Update a feature flag for this course.
setFriendlyName()  : void
setGradePassbackSetting()  : void
setGradingPeriods()  : void
setGradingStandardId()  : void
setHideFinalGrades()  : void
setHomeroomCourse()  : void
setId()  : void
setImageId()  : void
setImageUrl()  : void
setIntegrationId()  : void
setIsPublic()  : void
setIsPublicToAuthUsers()  : void
setLicense()  : void
setLocale()  : void
setLtiContextId()  : void
setName()  : void
setNeedsGradingCount()  : void
setOpenEnrollment()  : void
setOriginalName()  : void
setPermissions()  : void
setPostManually()  : void
setPublicDescription()  : void
setPublicSyllabus()  : void
setPublicSyllabusToAuth()  : void
setRestrictEnrollmentsToCourseDates()  : void
setRootAccountId()  : void
setSelfEnrollment()  : void
setSisCourseId()  : void
setSisImportId()  : void
setStartAt()  : void
setStorageQuotaMb()  : void
setStorageQuotaUsedMb()  : void
setSyllabusBody()  : void
setSyllabusCoursesSummary()  : void
setTemplate()  : void
setTerm()  : void
setTimetable()  : array<string, mixed>
Set course timetable
setTimetableEvents()  : array<string, mixed>
Set course timetable events directly
setTimeZone()  : void
setTotalStudents()  : void
setUseBlueprintRestrictionsByObjectType()  : void
setUuid()  : void
setWorkflowState()  : void
studentAnalytics()  : array<string, array<string, mixed>>
Get analytics for a specific student in this course
studentSummaries()  : array<int, array<string, mixed>>
Get student summaries for this course
tabs()  : array<string|int, Tab>
Get tabs for this course
update()  : self
Update an existing course
updateSettings()  : array<string|int, mixed>
Update course settings
castValue()  : DateTime|mixed
Cast a value to the correct type
checkApiClient()  : void
Check if the API client is set, if not, instantiate a new one
convertPaginatedResponseToModels()  : array<string|int, static>
Helper method to convert paginated response data to model instances
createConfiguredHttpClient()  : HttpClient
Create an HttpClient with configured middleware
createPaginationResult()  : PaginationResult
Helper method to create PaginationResult from paginated response
getEndpoint()  : string
Get the API endpoint for this resource
getPaginatedResponse()  : PaginatedResponse
Helper method to get paginated response from API endpoint
populate()  : void
Populate the object with new data
toDtoArray()  : array<string|int, mixed>
Convert the object to an array for DTO operations
createFromDTO()  : self
Create a new Course instance from a CreateCourseDTO
updateFromDTO()  : self
Update an existing course from a UpdateCourseDTO

Properties

$accessRestrictedByDate

public bool $accessRestrictedByDate = false

$accountId

public int $accountId

$allowStudentAssignmentEdits

public bool $allowStudentAssignmentEdits = false

$allowStudentForumAttachments

public bool $allowStudentForumAttachments = false

$allowWikiComments

public bool $allowWikiComments = false

$applyAssignmentGroupWeights

public bool $applyAssignmentGroupWeights = false

$bannerImageId

Optional: Course banner image ID for Canvas for Elementary

public int|null $bannerImageId = null

$bannerImageUrl

Optional: Course banner image URL for Canvas for Elementary

public string|null $bannerImageUrl = null

$blueprint

public bool $blueprint = false

$blueprintRestrictions

public array<string|int, mixed>|null $blueprintRestrictions = []

$blueprintRestrictionsByObjectType

public array<string|int, mixed>|null $blueprintRestrictionsByObjectType = []

$concluded

Optional: Whether course is concluded (computed field)

public bool|null $concluded = null

$conditionalRelease

Conditional release (individual learning paths) enabled

public bool $conditionalRelease = false

$courseCode

public string $courseCode

$courseColor

Optional: Course color in hex format for Canvas for Elementary

public string|null $courseColor = null

$courseFormat

public string $courseFormat = ''

$createdAt

public string $createdAt = ''

$defaultDueTime

Default due time for assignments (HH:MM:SS format)

public string $defaultDueTime = '23:59:59'

$defaultView

public string $defaultView = ''

$enableCoursePaces

Course pacing enabled flag

public bool $enableCoursePaces = false

$endAt

public string|null $endAt = null

$enrollments

public array<string|int, mixed>|null $enrollments = []

$enrollmentTermId

public int|null $enrollmentTermId = null

$friendlyName

Optional: Course friendly name for Canvas for Elementary

public string|null $friendlyName = null

$gradePassbackSetting

public string|null $gradePassbackSetting = null

$gradingPeriods

public array<string|int, mixed>|null $gradingPeriods = []

$gradingStandardId

public int|null $gradingStandardId = null

$hideFinalGrades

public bool $hideFinalGrades = false

$homeroomCourse

Optional: Sets the course as a homeroom course

public bool $homeroomCourse = false

$id

The unique identifier for the course

public int $id

$imageId

Optional: Course image ID if set

public int|null $imageId = null

$imageUrl

Optional: Course image URL if set

public string|null $imageUrl = null

$integrationId

public string|null $integrationId = null

$isPublic

public bool $isPublic = false

$isPublicToAuthUsers

public bool $isPublicToAuthUsers = false

$license

public string|null $license = ''

$locale

public string|null $locale = null

$ltiContextId

Optional: LTI context ID for the course

public string|null $ltiContextId = null

$needsGradingCount

public int|null $needsGradingCount = null

$openEnrollment

public bool $openEnrollment = false

$originalName

public string|null $originalName = null

$permissions

public array<string|int, mixed>|null $permissions = []

$postManually

Optional: Whether grades are posted manually or automatically

public bool|null $postManually = null

$publicDescription

public string|null $publicDescription = null

$publicSyllabus

public bool $publicSyllabus = false

$publicSyllabusToAuth

public bool $publicSyllabusToAuth = false

$restrictEnrollmentsToCourseDates

public bool $restrictEnrollmentsToCourseDates = false

$rootAccountId

public int $rootAccountId

$selfEnrollment

public bool $selfEnrollment = false

$sisCourseId

The SIS identifier for the course, if defined. This field is only included if the user has permission to view SIS information.

public string|null $sisCourseId = null

$sisImportId

The integration identifier for the course, if defined. This field is only included if the user has permission to view SIS information.

public int|null $sisImportId = null

$startAt

public string|null $startAt = null

$storageQuotaMb

public int $storageQuotaMb = 0

$storageQuotaUsedMb

public int $storageQuotaUsedMb = 0

$syllabusBody

public string|null $syllabusBody = null

$syllabusCoursesSummary

Syllabus course summary enabled (for syllabus page)

public bool $syllabusCoursesSummary = true

$template

public bool $template = false

$timeZone

public string $timeZone = ''

$totalStudents

public int|null $totalStudents = null

$useBlueprintRestrictionsByObjectType

Whether the course uses blueprint restrictions by object type

public bool $useBlueprintRestrictionsByObjectType = false

$uuid

The UUID of the course

public string $uuid

$workflowState

public string $workflowState

$methodAliases

Define method aliases

protected static array<string|int, mixed> $methodAliases = ['get' => ['fetch', 'list', 'fetchAll'], 'all' => ['fetchAllPages', 'getAll'], 'paginate' => ['getPaginated', 'withPagination', 'fetchPage'], 'find' => ['one', 'getOne']]

Methods

__callStatic()

Magic method to handle function aliases

public static __callStatic(string $name, array<string|int, mixed> $arguments) : mixed
Parameters
$name : string
$arguments : array<string|int, mixed>
Tags
throws
InvalidArgumentException

__construct()

Constructor

public __construct(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>

all()

Get all pages of results

public static all([array<string, mixed> $params = [] ]) : array<string|int, static>
Parameters
$params : array<string, mixed> = []

Query parameters

Return values
array<string|int, static>

analytics()

Get analytics data for this course

public analytics([array<string, mixed> $params = [] ]) : array<int, array<string, mixed>>
Parameters
$params : array<string, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
array<int, array<string, mixed>>

Activity data array

announcements()

Get announcements for this course

public announcements([array<string, mixed> $params = [] ]) : array<string|int, Announcement>

Returns ALL announcements for this course.

Parameters
$params : array<string, mixed> = []

Query parameters (active_only, etc.)

Tags
example
$course = Course::find(123);
$announcements = $course->announcements();

// With parameters
$activeAnnouncements = $course->announcements(['active_only' => true]);
throws
CanvasApiException
Return values
array<string|int, Announcement>

All announcements

assignmentAnalytics()

Get assignment analytics for this course

public assignmentAnalytics([array<string, mixed> $params = [] ]) : array<int, array<string, mixed>>
Parameters
$params : array<string, mixed> = []

Optional query parameters (e.g., ['async' => true])

Tags
throws
CanvasApiException
Return values
array<int, array<string, mixed>>

Array of assignment analytics

assignments()

Get assignments for this course

public assignments([array<string, mixed> $params = [] ]) : array<string|int, Assignment>

Returns ALL assignments for this course.

Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, Assignment>

All assignments

batchUpdate()

Batch update multiple courses

public static batchUpdate(int $accountId, array<string|int, int> $courseIds, string $event) : array<string|int, mixed>
Parameters
$accountId : int

Account ID containing the courses

$courseIds : array<string|int, int>

Array of course IDs to update

$event : string

Action to take (offer, conclude, delete, undelete)

Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Progress object for tracking the batch operation

calendarEvents()

Get calendar events for this course

public calendarEvents([array<string, mixed> $params = [] ]) : array<string|int, CalendarEvent>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, CalendarEvent>

conclude()

Conclude the course in the Canvas LMS system

public conclude() : self
Tags
throws
CanvasApiException
Return values
self

conferences()

Get conferences for this course.

public conferences([array<string, mixed> $params = [] ]) : array<string|int, Conference>
Parameters
$params : array<string, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, Conference>

contentMigrations()

Get content migrations for this course

public contentMigrations([array<string, mixed> $params = [] ]) : array<string|int, ContentMigration>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, ContentMigration>

copyContentFrom()

Copy content from another course

public copyContentFrom(int $sourceCourseId[, array<string, mixed> $options = [] ]) : ContentMigration
Parameters
$sourceCourseId : int

The course to copy content FROM

$options : array<string, mixed> = []

Additional options

Tags
throws
CanvasApiException
Return values
ContentMigration

copyCourseContent()

Copy course content DEPRECATED: Use Content Migrations API instead Copies content from one course into another

public copyCourseContent(string $sourceCourse[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$sourceCourse : string

Source course ID or SIS-ID

$options : array<string|int, mixed> = []

Copy options (except, only)

Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Course copy response

copyWithDateShift()

Copy content with date shifting

public copyWithDateShift(int $sourceCourseId, string $oldStartDate, string $newStartDate[, array<string, mixed> $options = [] ]) : ContentMigration
Parameters
$sourceCourseId : int

The course to copy content FROM

$oldStartDate : string

Original course start date (Y-m-d)

$newStartDate : string

New course start date (Y-m-d)

$options : array<string, mixed> = []

Additional options

Tags
throws
CanvasApiException
Return values
ContentMigration

create()

Create a new Course instance

public static create(CreateCourseDTO|array<string|int, mixed> $courseData) : self
Parameters
$courseData : CreateCourseDTO|array<string|int, mixed>
Tags
throws
Exception
Return values
self

createFile()

Create a file upload to the course This API endpoint is the first step in uploading a file to a course

public createFile(array<string|int, mixed> $fileParams) : array<string|int, mixed>
Parameters
$fileParams : array<string|int, mixed>

File upload parameters

Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

File upload response

createReport()

Start generating a new report for this course

public createReport(string $reportType[, array<string, mixed> $parameters = [] ]) : CourseReports
Parameters
$reportType : string

Type of report to generate (e.g., 'grade_export', 'student_assignment_data')

$parameters : array<string, mixed> = []

Additional parameters for report generation

Tags
throws
CanvasApiException
Return values
CourseReports

New report instance with status

delete()

Delete the course from the Canvas LMS system

public delete() : self
Tags
throws
CanvasApiException
Return values
self

discussionTopics()

Get discussion topics for this course

public discussionTopics([array<string, mixed> $params = [] ]) : array<string|int, DiscussionTopic>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, DiscussionTopic>

dismissQuizMigrationAlert()

Remove quiz migration alert Remove alert about quiz migration limitations displayed to user

public dismissQuizMigrationAlert() : array<string|int, mixed>
Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Success response

enrollments()

Get enrollments for this course (relationship method alias with parameter support)

public enrollments([array<string|int, mixed> $params = [] ]) : array<string|int, Enrollment>

This method provides a clean, explicit way to access course enrollments without conflicts with Canvas API data structure. Supports all Canvas API enrollment parameters for filtering.

Parameters
$params : array<string|int, mixed> = []

Query parameters for filtering enrollments:

  • type[]: Filter by enrollment type (e.g., ['StudentEnrollment', 'TeacherEnrollment'])
  • role[]: Filter by enrollment role
  • state[]: Filter by enrollment state (e.g., ['active', 'invited'])
  • user_id: Filter by specific user ID
  • include[]: Include additional data (e.g., ['user', 'avatar_url'])
Tags
example
$course = Course::find(123);

// Get all enrollments
$enrollments = $course->enrollments();

// Get active student enrollments
$activeStudents = $course->enrollments([
    'type[]' => ['StudentEnrollment'],
    'state[]' => ['active']
]);

// Get enrollments with user data included
$enrollmentsWithUsers = $course->enrollments([
    'include[]' => ['user']
]);
throws
CanvasApiException

If the course ID is not set or API request fails

Return values
array<string|int, Enrollment>

Array of Enrollment objects

externalTools()

Get external tools for this course

public externalTools([array<string, mixed> $params = [] ]) : array<string|int, ExternalTool>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, ExternalTool>

featureFlag()

Get a specific feature flag for this course.

public featureFlag(string $featureName) : FeatureFlag
Parameters
$featureName : string

The symbolic name of the feature

Tags
throws
CanvasApiException
Return values
FeatureFlag

featureFlags()

Get all feature flags for this course.

public featureFlags([array<string, mixed> $params = [] ]) : array<int, FeatureFlag>
Parameters
$params : array<string, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
array<int, FeatureFlag>

Array of FeatureFlag objects

files()

Get files for this course

public files([array<string, mixed> $params = [] ]) : array<string|int, File>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, File>

find()

Find a course by ID

public static find(int $id[, array<string|int, mixed> $params = [] ]) : self
Parameters
$id : int
$params : array<string|int, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
self

get()

Fetch all courses

public static get([array<string|int, mixed> $params = [] ]) : array<string|int, Course>
Parameters
$params : array<string|int, mixed> = []
Tags
throws
CanvasApiException
Return values
array<string|int, Course>

getAccountId()

public getAccountId() : int
Return values
int

getActiveEnrollments()

Get active enrollments for this course

public getActiveEnrollments([array<string|int, mixed> $params = [] ]) : array<string|int, Enrollment>

Convenience method to get only active enrollments in the current course.

Parameters
$params : array<string|int, mixed> = []

Additional query parameters

Tags
throws
CanvasApiException

If course ID is not set or API request fails

Return values
array<string|int, Enrollment>

Array of active Enrollment objects

getActivityStream()

Get current user's course-specific activity stream

public getActivityStream([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Optional parameters for filtering

Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Activity stream data

getActivityStreamSummary()

Get current user's course-specific activity stream summary

public getActivityStreamSummary() : array<string|int, mixed>
Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Activity stream summary data

getBannerImageId()

public getBannerImageId() : int|null
Return values
int|null

getBannerImageUrl()

public getBannerImageUrl() : string|null
Return values
string|null

getBlueprintRestrictions()

public getBlueprintRestrictions() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getBlueprintRestrictionsByObjectType()

public getBlueprintRestrictionsByObjectType() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getBulkUserProgress()

Get bulk user progress for all users in this course

public getBulkUserProgress() : array<string|int, mixed>
Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Array of user progress data

getCourseCode()

public getCourseCode() : string
Return values
string

getCourseColor()

public getCourseColor() : string|null
Return values
string|null

getCourseCopyStatus()

Get course copy status DEPRECATED: Use Content Migrations API instead Retrieve the status of a course copy operation

public getCourseCopyStatus(int $copyId) : array<string|int, mixed>
Parameters
$copyId : int

Course copy ID

Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Course copy status

getCourseFormat()

public getCourseFormat() : string
Return values
string

getCreatedAt()

public getCreatedAt() : string
Return values
string

getDefaultDueTime()

public getDefaultDueTime() : string
Return values
string

getDefaultView()

public getDefaultView() : string
Return values
string

getDesignerEnrollments()

Get designer enrollments for this course

public getDesignerEnrollments([array<string|int, mixed> $params = [] ]) : array<string|int, Enrollment>

Convenience method to get only designer enrollments in the current course.

Parameters
$params : array<string|int, mixed> = []

Additional query parameters

Tags
throws
CanvasApiException

If course ID is not set or API request fails

Return values
array<string|int, Enrollment>

Array of designer Enrollment objects

getEffectiveDueDates()

Get effective due dates for assignments in this course

public getEffectiveDueDates([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Optional parameters like assignment_ids

Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Effective due dates data

getEndAt()

public getEndAt() : string|null
Return values
string|null

getEnrollments()

public getEnrollments() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getEnrollmentsData()

Get the course's enrollment data array (legacy method - uses embedded data)

public getEnrollmentsData() : array<string|int, mixed>|null

This returns the raw enrollments array that may be embedded in the course object from certain Canvas API calls. For fetching current enrollments from the API, use enrollments() instead.

Return values
array<string|int, mixed>|null

Raw enrollments data array or null

getEnrollmentTermId()

public getEnrollmentTermId() : int|null
Return values
int|null

getFriendlyName()

public getFriendlyName() : string|null
Return values
string|null

getGradebookHistoryDays()

Get days with grading activity in this course.

public getGradebookHistoryDays([array<string, mixed> $params = [] ]) : array<string|int, GradebookHistoryDay>
Parameters
$params : array<string, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, GradebookHistoryDay>

getGradebookHistoryForDay()

Get graders who had activity on a specific day.

public getGradebookHistoryForDay(string $date[, array<string, mixed> $params = [] ]) : array<string|int, GradebookHistoryGrader>
Parameters
$date : string

The date in YYYY-MM-DD format

$params : array<string, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, GradebookHistoryGrader>

getGradePassbackSetting()

public getGradePassbackSetting() : string|null
Return values
string|null

getGradingPeriods()

public getGradingPeriods() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getGradingStandardId()

public getGradingStandardId() : int|null
Return values
int|null

getId()

public getId() : int
Return values
int

getImageId()

public getImageId() : int|null
Return values
int|null

getImageUrl()

public getImageUrl() : string|null
Return values
string|null

getIntegrationId()

public getIntegrationId() : string|null
Return values
string|null

getLastReport()

Get the status of the last report of the specified type for this course

public getLastReport(string $reportType) : CourseReports
Parameters
$reportType : string

Type of report to check

Tags
throws
CanvasApiException
Return values
CourseReports

Last report instance with status

getLicense()

public getLicense() : string|null
Return values
string|null

getLocale()

public getLocale() : string|null
Return values
string|null

getLtiContextId()

public getLtiContextId() : string|null
Return values
string|null

getName()

public getName() : string
Return values
string

getNeedsGradingCount()

public getNeedsGradingCount() : int|null
Return values
int|null

getObserverEnrollments()

Get observer enrollments for this course

public getObserverEnrollments([array<string|int, mixed> $params = [] ]) : array<string|int, Enrollment>

Convenience method to get only observer enrollments in the current course.

Parameters
$params : array<string|int, mixed> = []

Additional query parameters

Tags
throws
CanvasApiException

If course ID is not set or API request fails

Return values
array<string|int, Enrollment>

Array of observer Enrollment objects

getOriginalName()

public getOriginalName() : string|null
Return values
string|null

getPermissions()

public getPermissions() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getPublicDescription()

public getPublicDescription() : string|null
Return values
string|null

getRecentStudents()

Get recently logged in students in this course

public getRecentStudents() : array<string|int, mixed>
Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Array of recently logged in user data

getReport()

Get the status of a specific report for this course

public getReport(string $reportType, int $reportId) : CourseReports
Parameters
$reportType : string

Type of report to check

$reportId : int

ID of the specific report

Tags
throws
CanvasApiException
Return values
CourseReports

Report instance with current status

getRootAccountId()

public getRootAccountId() : int
Return values
int

getSettings()

Get course settings

public static getSettings(int $courseId) : array<string|int, mixed>
Parameters
$courseId : int
Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Course settings array

getSisCourseId()

public getSisCourseId() : string|null
Return values
string|null

getSisImportId()

public getSisImportId() : int|null
Return values
int|null

getStartAt()

public getStartAt() : string|null
Return values
string|null

getStorageQuotaMb()

public getStorageQuotaMb() : int
Return values
int

getStorageQuotaUsedMb()

public getStorageQuotaUsedMb() : int
Return values
int

getStudentCount()

Get the count of student enrollments in this course

public getStudentCount() : int
Tags
throws
CanvasApiException

If course ID is not set or API request fails

Return values
int

Number of student enrollments

getStudentEnrollments()

Get student enrollments for this course

public getStudentEnrollments([array<string|int, mixed> $params = [] ]) : array<string|int, Enrollment>

Convenience method to get only student enrollments in the current course.

Parameters
$params : array<string|int, mixed> = []

Additional query parameters

Tags
throws
CanvasApiException

If course ID is not set or API request fails

Return values
array<string|int, Enrollment>

Array of student Enrollment objects

getStudents()

Get students in this course (legacy method - use getUsers with enrollment_type filter instead)

public getStudents([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>

Use getUsers() with enrollment_type[] = ['student'] instead

Parameters
$params : array<string|int, mixed> = []

Optional parameters

Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Array of student data

getSyllabusBody()

public getSyllabusBody() : string|null
Return values
string|null

getTaEnrollments()

Get TA enrollments for this course

public getTaEnrollments([array<string|int, mixed> $params = [] ]) : array<string|int, Enrollment>

Convenience method to get only TA enrollments in the current course.

Parameters
$params : array<string|int, mixed> = []

Additional query parameters

Tags
throws
CanvasApiException

If course ID is not set or API request fails

Return values
array<string|int, Enrollment>

Array of TA Enrollment objects

getTeacherCount()

Get the count of teacher enrollments in this course

public getTeacherCount() : int
Tags
throws
CanvasApiException

If course ID is not set or API request fails

Return values
int

Number of teacher enrollments

getTeacherEnrollments()

Get teacher enrollments for this course

public getTeacherEnrollments([array<string|int, mixed> $params = [] ]) : array<string|int, Enrollment>

Convenience method to get only teacher enrollments in the current course.

Parameters
$params : array<string|int, mixed> = []

Additional query parameters

Tags
throws
CanvasApiException

If course ID is not set or API request fails

Return values
array<string|int, Enrollment>

Array of teacher Enrollment objects

getTestStudent()

Get or create a test student for this course

public getTestStudent() : array<string|int, mixed>
Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Test student user data

getTimetable()

Get course timetable

public getTimetable() : array<string, mixed>
Tags
throws
CanvasApiException
Return values
array<string, mixed>

getTimeZone()

public getTimeZone() : string
Return values
string

getTodoItems()

Get current user's course-specific TODO items

public getTodoItems() : array<string|int, mixed>
Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

TODO items data

getTotalEnrollmentCount()

Get the count of total enrollments in this course

public getTotalEnrollmentCount([array<string|int, mixed> $params = [] ]) : int
Parameters
$params : array<string|int, mixed> = []

Optional parameters to filter the count

Tags
throws
CanvasApiException

If course ID is not set or API request fails

Return values
int

Total number of enrollments (with optional filters)

getTotalStudents()

public getTotalStudents() : int|null
Return values
int|null

getUser()

Get a single user in this course

public getUser(int $userId[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$userId : int

User ID to retrieve

$params : array<string|int, mixed> = []

Optional parameters like include[]

Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

User data

getUserProgress()

Get user progress in this course

public getUserProgress(int $userId) : array<string|int, mixed>
Parameters
$userId : int
Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Course progress data

getUsers()

List users in this course with optional filtering

public getUsers([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameters for filtering users

Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Array of user data

getUuid()

public getUuid() : string
Return values
string

getWorkflowState()

public getWorkflowState() : string
Return values
string

groupCategories()

Get group categories in this course

public groupCategories([array<string, mixed> $params = [] ]) : array<string|int, GroupCategory>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, GroupCategory>

groups()

Get groups in this course

public groups([array<string, mixed> $params = [] ]) : array<string|int, Group>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, Group>

hasStudentEnrolled()

Check if a specific user is a student in this course

public hasStudentEnrolled(int $userId) : bool
Parameters
$userId : int

The user ID to check

Tags
throws
CanvasApiException

If course ID is not set or API request fails

Return values
bool

True if user has a student enrollment in the course

hasTeacherEnrolled()

Check if a specific user is a teacher in this course

public hasTeacherEnrolled(int $userId) : bool
Parameters
$userId : int

The user ID to check

Tags
throws
CanvasApiException

If course ID is not set or API request fails

Return values
bool

True if user has a teacher enrollment in the course

hasUserEnrolled()

Check if a specific user is enrolled in this course

public hasUserEnrolled(int $userId[, string|null $enrollmentType = null ]) : bool
Parameters
$userId : int

The user ID to check enrollment for

$enrollmentType : string|null = null

Optional: specific enrollment type to check for

Tags
throws
CanvasApiException

If course ID is not set or API request fails

Return values
bool

True if user is enrolled in the course (with optional type filter)

importCommonCartridge()

Import content from a Common Cartridge file

public importCommonCartridge(string $filePath[, array<string, mixed> $options = [] ]) : ContentMigration
Parameters
$filePath : string

Path to the .imscc file

$options : array<string, mixed> = []

Additional options

Tags
throws
CanvasApiException
Return values
ContentMigration

importOutcomes()

Import outcomes to this course from a CSV file

public importOutcomes(string $filePath[, int|null $groupId = null ][, string $importType = 'instructure_csv' ]) : OutcomeImport
Parameters
$filePath : string

Path to the CSV file

$groupId : int|null = null

Optional outcome group ID to import into

$importType : string = 'instructure_csv'

Import type (default: 'instructure_csv')

Tags
throws
CanvasApiException
Return values
OutcomeImport

importOutcomesFromData()

Import outcomes to this course from CSV data

public importOutcomesFromData(string $csvData[, int|null $groupId = null ][, string $importType = 'instructure_csv' ]) : OutcomeImport
Parameters
$csvData : string

Raw CSV data

$groupId : int|null = null

Optional outcome group ID to import into

$importType : string = 'instructure_csv'

Import type (default: 'instructure_csv')

Tags
throws
CanvasApiException
Return values
OutcomeImport

importZipFile()

Import content from a ZIP file

public importZipFile(string $filePath[, array<string, mixed> $options = [] ]) : ContentMigration
Parameters
$filePath : string

Path to the .zip file

$options : array<string, mixed> = []

Additional options

Tags
throws
CanvasApiException
Return values
ContentMigration

isAccessRestrictedByDate()

public isAccessRestrictedByDate() : bool
Return values
bool

isAllowStudentAssignmentEdits()

public isAllowStudentAssignmentEdits() : bool
Return values
bool

isAllowStudentForumAttachments()

public isAllowStudentForumAttachments() : bool
Return values
bool

isAllowWikiComments()

public isAllowWikiComments() : bool
Return values
bool

isApplyAssignmentGroupWeights()

public isApplyAssignmentGroupWeights() : bool
Return values
bool

isBlueprint()

public isBlueprint() : bool
Return values
bool

isConcluded()

public isConcluded() : bool|null
Return values
bool|null

isConditionalRelease()

public isConditionalRelease() : bool
Return values
bool

isEnableCoursePaces()

public isEnableCoursePaces() : bool
Return values
bool

isHideFinalGrades()

public isHideFinalGrades() : bool
Return values
bool

isHomeroomCourse()

public isHomeroomCourse() : bool
Return values
bool

isOpenEnrollment()

public isOpenEnrollment() : bool
Return values
bool

isPostManually()

public isPostManually() : bool|null
Return values
bool|null

isPublic()

public isPublic() : bool
Return values
bool

isPublicSyllabus()

public isPublicSyllabus() : bool
Return values
bool

isPublicSyllabusToAuth()

public isPublicSyllabusToAuth() : bool
Return values
bool

isPublicToAuthUsers()

public isPublicToAuthUsers() : bool
Return values
bool

isRestrictEnrollmentsToCourseDates()

public isRestrictEnrollmentsToCourseDates() : bool
Return values
bool

isSelfEnrollment()

public isSelfEnrollment() : bool
Return values
bool

isSyllabusCoursesSummary()

public isSyllabusCoursesSummary() : bool
Return values
bool

isTemplate()

public isTemplate() : bool
Return values
bool

isUseBlueprintRestrictionsByObjectType()

public isUseBlueprintRestrictionsByObjectType() : bool
Return values
bool

linkOutcome()

Link an existing outcome to this course.

public linkOutcome(int $outcomeId[, int|null $groupId = null ][, int|null $moveFrom = null ]) : OutcomeLink
Parameters
$outcomeId : int

The outcome ID to link

$groupId : int|null = null

The group to link into (null for root group)

$moveFrom : int|null = null

The group ID to move from (optional)

Tags
throws
CanvasApiException
Return values
OutcomeLink

mediaAttachments()

Get media attachments for this course

public mediaAttachments([array<string, mixed> $params = [] ]) : array<string|int, MediaObject>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, MediaObject>

Array of MediaObject instances

mediaObjects()

Get media objects for this course

public mediaObjects([array<string, mixed> $params = [] ]) : array<string|int, MediaObject>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, MediaObject>

Array of MediaObject instances

modules()

Get modules for this course

public modules([array<string, mixed> $params = [] ]) : array<string|int, Module>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, Module>

outcomeGroups()

Get outcome groups for this course

public outcomeGroups([array<string, mixed> $params = [] ]) : array<int, OutcomeGroup>
Parameters
$params : array<string, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
array<int, OutcomeGroup>

Array of OutcomeGroup objects

Get all outcome links for this course (across all groups).

public outcomeLinks([array<string, mixed> $params = [] ]) : array<int, OutcomeLink>
Parameters
$params : array<string, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
array<int, OutcomeLink>

Array of OutcomeLink objects

outcomeResults()

Get outcome results for this course

public outcomeResults([array<string, mixed> $params = [] ]) : array<int, OutcomeResult>
Parameters
$params : array<string, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
array<int, OutcomeResult>

Array of OutcomeResult objects

outcomeRollups()

Fetch outcome rollups for this course.

public outcomeRollups([array<string, mixed> $params = [] ]) : array<string, mixed>
Parameters
$params : array<string, mixed> = []

Optional query parameters (aggregate, aggregate_stat, user_ids, outcome_ids, etc.)

Tags
throws
CanvasApiException
Return values
array<string, mixed>

Rollup data with rollups and linked data

outcomeRollupsAggregate()

Fetch course aggregate outcome rollup.

public outcomeRollupsAggregate([string $aggregateStat = 'mean' ][, array<string, mixed> $params = [] ]) : array<string, mixed>
Parameters
$aggregateStat : string = 'mean'

Statistic type (mean, median)

$params : array<string, mixed> = []

Additional query parameters

Tags
throws
CanvasApiException
Return values
array<string, mixed>

Rollup data with aggregate results

outcomeRollupsExportCSV()

Export outcome rollups to CSV for this course.

public outcomeRollupsExportCSV([array<string, mixed> $params = [] ]) : string
Parameters
$params : array<string, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
string

CSV data

outcomes()

Get outcomes for this course.

public outcomes([array<string, mixed> $params = [] ]) : array<int, OutcomeLink>

Note: This returns OutcomeLink objects as per Canvas API.

Parameters
$params : array<string, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
array<int, OutcomeLink>

Array of OutcomeLink objects

pages()

Get pages for this course

public pages([array<string, mixed> $params = [] ]) : array<string|int, Page>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, Page>

permissions()

Get permissions for the current user in this course (relationship method)

public permissions([array<string|int, string> $permissions = [] ]) : array<string|int, mixed>
Parameters
$permissions : array<string|int, string> = []

List of permissions to check

Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Permissions data

previewHtml()

Preview HTML content processed for this course

public previewHtml(string $html) : array<string|int, mixed>
Parameters
$html : string

HTML content to preview

Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Processed HTML data

quizzes()

Get quizzes for this course

public quizzes([array<string, mixed> $params = [] ]) : array<string|int, Quiz>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, Quiz>

removeFeatureFlag()

Remove a feature flag for this course.

public removeFeatureFlag(string $featureName) : bool
Parameters
$featureName : string

The symbolic name of the feature

Tags
throws
CanvasApiException
Return values
bool

reset()

Deletes the current course, and creates a new equivalent course with no content, but all sections and users moved over

public reset() : self
Tags
throws
CanvasApiException
throws
Exception
Return values
self

rubrics()

Get rubrics for this course

public rubrics([array<string, mixed> $params = [] ]) : array<string|int, Rubric>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, Rubric>

searchContentShareUsers()

Search for content share users in this course

public searchContentShareUsers(string $searchTerm) : array<string|int, mixed>
Parameters
$searchTerm : string

Term to search for users

Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Array of users available for content sharing

sections()

Get sections for this course

public sections([array<string, mixed> $params = [] ]) : array<string|int, Section>
Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, Section>

selectiveCopyFrom()

Create a selective course copy

public selectiveCopyFrom(int $sourceCourseId, array<string, array<string|int, string|int>> $selections[, array<string, mixed> $options = [] ]) : ContentMigration
Parameters
$sourceCourseId : int

The course to copy content FROM

$selections : array<string, array<string|int, string|int>>

Items to copy

$options : array<string, mixed> = []

Additional options

Tags
throws
CanvasApiException
Return values
ContentMigration

setAccessRestrictedByDate()

public setAccessRestrictedByDate(bool $accessRestrictedByDate) : void
Parameters
$accessRestrictedByDate : bool

setAccountId()

public setAccountId(int $accountId) : void
Parameters
$accountId : int

setAllowStudentAssignmentEdits()

public setAllowStudentAssignmentEdits(bool $allowStudentAssignmentEdits) : void
Parameters
$allowStudentAssignmentEdits : bool

setAllowStudentForumAttachments()

public setAllowStudentForumAttachments(bool $allowStudentForumAttachments) : void
Parameters
$allowStudentForumAttachments : bool

setAllowWikiComments()

public setAllowWikiComments(bool $allowWikiComments) : void
Parameters
$allowWikiComments : bool

setApplyAssignmentGroupWeights()

public setApplyAssignmentGroupWeights(bool $applyAssignmentGroupWeights) : void
Parameters
$applyAssignmentGroupWeights : bool

setBannerImageId()

public setBannerImageId(int|null $bannerImageId) : void
Parameters
$bannerImageId : int|null

setBannerImageUrl()

public setBannerImageUrl(string|null $bannerImageUrl) : void
Parameters
$bannerImageUrl : string|null

setBlueprint()

public setBlueprint(bool $blueprint) : void
Parameters
$blueprint : bool

setBlueprintRestrictions()

public setBlueprintRestrictions(array<string|int, mixed>|null $blueprintRestrictions) : void
Parameters
$blueprintRestrictions : array<string|int, mixed>|null

setBlueprintRestrictionsByObjectType()

public setBlueprintRestrictionsByObjectType(array<string|int, mixed>|null $blueprintRestrictionsByObjectType) : void
Parameters
$blueprintRestrictionsByObjectType : array<string|int, mixed>|null

setConcluded()

public setConcluded(bool|null $concluded) : void
Parameters
$concluded : bool|null

setConditionalRelease()

public setConditionalRelease(bool $conditionalRelease) : void
Parameters
$conditionalRelease : bool

setCourseCode()

public setCourseCode(string $courseCode) : void
Parameters
$courseCode : string

setCourseColor()

public setCourseColor(string|null $courseColor) : void
Parameters
$courseColor : string|null

Hex color code (e.g., '#ff0000' or 'ff0000')

Tags
throws
InvalidArgumentException

If color format is invalid

setCourseFormat()

public setCourseFormat(string $courseFormat) : void
Parameters
$courseFormat : string

setCreatedAt()

public setCreatedAt(string $createdAt) : void
Parameters
$createdAt : string

setDefaultDueTime()

public setDefaultDueTime(string $defaultDueTime) : void
Parameters
$defaultDueTime : string

Time in HH:MM:SS format (e.g., '23:59:59') or 'inherit'

Tags
throws
InvalidArgumentException

If time format is invalid

setDefaultView()

public setDefaultView(string $defaultView) : void
Parameters
$defaultView : string

setEnableCoursePaces()

public setEnableCoursePaces(bool $enableCoursePaces) : void
Parameters
$enableCoursePaces : bool

setEndAt()

public setEndAt(string|null $endAt) : void
Parameters
$endAt : string|null

setEnrollments()

public setEnrollments(array<string|int, mixed>|null $enrollments) : void
Parameters
$enrollments : array<string|int, mixed>|null

setEnrollmentTermId()

public setEnrollmentTermId(int|null $enrollmentTermId) : void
Parameters
$enrollmentTermId : int|null

setFriendlyName()

public setFriendlyName(string|null $friendlyName) : void
Parameters
$friendlyName : string|null

setGradePassbackSetting()

public setGradePassbackSetting(string|null $gradePassbackSetting) : void
Parameters
$gradePassbackSetting : string|null

setGradingPeriods()

public setGradingPeriods(array<string|int, mixed>|null $gradingPeriods) : void
Parameters
$gradingPeriods : array<string|int, mixed>|null

setGradingStandardId()

public setGradingStandardId(int|null $gradingStandardId) : void
Parameters
$gradingStandardId : int|null

setHideFinalGrades()

public setHideFinalGrades(bool $hideFinalGrades) : void
Parameters
$hideFinalGrades : bool

setHomeroomCourse()

public setHomeroomCourse(bool $homeroomCourse) : void
Parameters
$homeroomCourse : bool

setId()

public setId(int $id) : void
Parameters
$id : int

setImageId()

public setImageId(int|null $imageId) : void
Parameters
$imageId : int|null

setImageUrl()

public setImageUrl(string|null $imageUrl) : void
Parameters
$imageUrl : string|null

setIntegrationId()

public setIntegrationId(string|null $integrationId) : void
Parameters
$integrationId : string|null

setIsPublic()

public setIsPublic(bool $isPublic) : void
Parameters
$isPublic : bool

setIsPublicToAuthUsers()

public setIsPublicToAuthUsers(bool $isPublicToAuthUsers) : void
Parameters
$isPublicToAuthUsers : bool

setLicense()

public setLicense(string|null $license) : void
Parameters
$license : string|null

setLocale()

public setLocale(string|null $locale) : void
Parameters
$locale : string|null

setLtiContextId()

public setLtiContextId(string|null $ltiContextId) : void
Parameters
$ltiContextId : string|null

setName()

public setName(string $name) : void
Parameters
$name : string

setNeedsGradingCount()

public setNeedsGradingCount(int|null $needsGradingCount) : void
Parameters
$needsGradingCount : int|null

setOpenEnrollment()

public setOpenEnrollment(bool $openEnrollment) : void
Parameters
$openEnrollment : bool

setOriginalName()

public setOriginalName(string|null $originalName) : void
Parameters
$originalName : string|null

setPermissions()

public setPermissions(array<string|int, mixed>|null $permissions) : void
Parameters
$permissions : array<string|int, mixed>|null

setPostManually()

public setPostManually(bool|null $postManually) : void
Parameters
$postManually : bool|null

setPublicDescription()

public setPublicDescription(string|null $publicDescription) : void
Parameters
$publicDescription : string|null

setPublicSyllabus()

public setPublicSyllabus(bool $publicSyllabus) : void
Parameters
$publicSyllabus : bool

setPublicSyllabusToAuth()

public setPublicSyllabusToAuth(bool $publicSyllabusToAuth) : void
Parameters
$publicSyllabusToAuth : bool

setRestrictEnrollmentsToCourseDates()

public setRestrictEnrollmentsToCourseDates(bool $restrictEnrollmentsToCourseDates) : void
Parameters
$restrictEnrollmentsToCourseDates : bool

setRootAccountId()

public setRootAccountId(int $rootAccountId) : void
Parameters
$rootAccountId : int

setSelfEnrollment()

public setSelfEnrollment(bool $selfEnrollment) : void
Parameters
$selfEnrollment : bool

setSisCourseId()

public setSisCourseId(string|null $sisCourseId) : void
Parameters
$sisCourseId : string|null

setSisImportId()

public setSisImportId(int|null $sisImportId) : void
Parameters
$sisImportId : int|null

setStartAt()

public setStartAt(string|null $startAt) : void
Parameters
$startAt : string|null

setStorageQuotaMb()

public setStorageQuotaMb(int $storageQuotaMb) : void
Parameters
$storageQuotaMb : int

setStorageQuotaUsedMb()

public setStorageQuotaUsedMb(int $storageQuotaUsedMb) : void
Parameters
$storageQuotaUsedMb : int

setSyllabusBody()

public setSyllabusBody(string|null $syllabusBody) : void
Parameters
$syllabusBody : string|null

setSyllabusCoursesSummary()

public setSyllabusCoursesSummary(bool $syllabusCoursesSummary) : void
Parameters
$syllabusCoursesSummary : bool

setTemplate()

public setTemplate(bool $template) : void
Parameters
$template : bool

setTerm()

public setTerm(Term|null $term) : void
Parameters
$term : Term|null

setTimetable()

Set course timetable

public setTimetable(array<string, array<int, array{weekdays: string, start_time: string, end_time: string, location_name?: string}>> $timetables) : array<string, mixed>
Parameters
$timetables : array<string, array<int, array{weekdays: string, start_time: string, end_time: string, location_name?: string}>>
Tags
throws
CanvasApiException
Return values
array<string, mixed>

setTimetableEvents()

Set course timetable events directly

public setTimetableEvents(array<int, DateTime|string, location_name?: string, code?: string, title?: string}$events[, string|null $sectionId = null ]) : array<string, mixed>
Parameters
$events : array<int, DateTime|string, location_name?: string, code?: string, title?: string}>
$sectionId : string|null = null
Tags
throws
CanvasApiException
Return values
array<string, mixed>

setTimeZone()

public setTimeZone(string $timeZone) : void
Parameters
$timeZone : string

setTotalStudents()

public setTotalStudents(int|null $totalStudents) : void
Parameters
$totalStudents : int|null

setUseBlueprintRestrictionsByObjectType()

public setUseBlueprintRestrictionsByObjectType(bool $useBlueprintRestrictionsByObjectType) : void
Parameters
$useBlueprintRestrictionsByObjectType : bool

setUuid()

public setUuid(string $uuid) : void
Parameters
$uuid : string

setWorkflowState()

public setWorkflowState(string $workflowState) : void
Parameters
$workflowState : string

studentAnalytics()

Get analytics for a specific student in this course

public studentAnalytics(int $studentId[, array<string, mixed> $params = [] ]) : array<string, array<string, mixed>>
Parameters
$studentId : int

The student/user ID

$params : array<string, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
array<string, array<string, mixed>>

Analytics data for the student

studentSummaries()

Get student summaries for this course

public studentSummaries([array<string, mixed> $params = [] ]) : array<int, array<string, mixed>>
Parameters
$params : array<string, mixed> = []

Optional query parameters (e.g., ['sort_column' => 'name'])

Tags
throws
CanvasApiException
Return values
array<int, array<string, mixed>>

Array of student summaries

updateSettings()

Update course settings

public static updateSettings(int $courseId, array<string|int, mixed> $settings) : array<string|int, mixed>
Parameters
$courseId : int
$settings : array<string|int, mixed>
Tags
throws
CanvasApiException
Return values
array<string|int, mixed>

Updated settings

castValue()

Cast a value to the correct type

protected castValue(string $key, mixed $value) : DateTime|mixed
Parameters
$key : string
$value : mixed
Tags
throws
Exception
Return values
DateTime|mixed

checkApiClient()

Check if the API client is set, if not, instantiate a new one

protected static checkApiClient() : void

convertPaginatedResponseToModels()

Helper method to convert paginated response data to model instances

protected static convertPaginatedResponseToModels(PaginatedResponse $paginatedResponse) : array<string|int, static>
Parameters
$paginatedResponse : PaginatedResponse
Return values
array<string|int, static>

getEndpoint()

Get the API endpoint for this resource

protected static getEndpoint() : string
Return values
string

getPaginatedResponse()

Helper method to get paginated response from API endpoint

protected static getPaginatedResponse(string $endpoint[, array<string|int, mixed> $params = [] ]) : PaginatedResponse
Parameters
$endpoint : string

The API endpoint path

$params : array<string|int, mixed> = []

Query parameters for the request

Return values
PaginatedResponse

populate()

Populate the object with new data

protected populate(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>
Tags
throws
Exception

toDtoArray()

Convert the object to an array for DTO operations

protected toDtoArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results