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
= []
$calendar
public
CalendarLink|null
$calendar
= null
$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
= ''
$courseProgress
public
CourseProgress|null
$courseProgress
= null
$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
$name
public
string
$name
$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
$term
public
Term|null
$term
= null
$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
$apiClient
protected
static HttpClientInterface
$apiClient
= null
$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
__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
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
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
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
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
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
Return values
array<string|int, CalendarEvent>conclude()
Conclude the course in the Canvas LMS system
public
conclude() : self
Tags
Return values
selfconferences()
Get conferences for this course.
public
conferences([array<string, mixed> $params = [] ]) : array<string|int, Conference>
Parameters
- $params : array<string, mixed> = []
-
Optional query parameters
Tags
Return values
array<string|int, Conference>contentMigration()
Get a specific content migration for this course
public
contentMigration(int $migrationId) : ContentMigration
Parameters
- $migrationId : int
-
Content migration ID
Tags
Return values
ContentMigrationcontentMigrations()
Get content migrations for this course
public
contentMigrations([array<string, mixed> $params = [] ]) : array<string|int, ContentMigration>
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Tags
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
Return values
ContentMigrationcopyCourseContent()
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
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
Return values
ContentMigrationcreate()
Create a new Course instance
public
static create(CreateCourseDTO|array<string|int, mixed> $courseData) : self
Parameters
- $courseData : CreateCourseDTO|array<string|int, mixed>
Tags
Return values
selfcreateCalendarEvent()
Create a calendar event for this course
public
createCalendarEvent(CreateCalendarEventDTO|array<string, mixed> $data) : CalendarEvent
Parameters
- $data : CreateCalendarEventDTO|array<string, mixed>
Tags
Return values
CalendarEventcreateConference()
Create a conference for this course.
public
createConference(array<string, mixed>|CreateConferenceDTO $data) : Conference
Parameters
- $data : array<string, mixed>|CreateConferenceDTO
-
Conference data
Tags
Return values
ConferencecreateContentMigration()
Create a content migration for this course
public
createContentMigration(array<string, mixed>|CreateContentMigrationDTO $data) : ContentMigration
Parameters
- $data : array<string, mixed>|CreateContentMigrationDTO
-
Migration data
Tags
Return values
ContentMigrationcreateFile()
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
Return values
array<string|int, mixed> —File upload response
createGroupCategory()
Create a group category in this course
public
createGroupCategory(array<string, mixed>|CreateGroupCategoryDTO $data) : GroupCategory
Parameters
- $data : array<string, mixed>|CreateGroupCategoryDTO
-
Group category data
Tags
Return values
GroupCategorycreateOutcome()
Create a new outcome directly in this course.
public
createOutcome(array<string, mixed>|CreateOutcomeDTO $data[, int|null $groupId = null ]) : OutcomeLink
Parameters
- $data : array<string, mixed>|CreateOutcomeDTO
-
Outcome data
- $groupId : int|null = null
-
The group to create in (null for root group)
Tags
Return values
OutcomeLinkcreateReport()
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
Return values
CourseReports —New report instance with status
delete()
Delete the course from the Canvas LMS system
public
delete() : self
Tags
Return values
selfdiscussionTopics()
Get discussion topics for this course
public
discussionTopics([array<string, mixed> $params = [] ]) : array<string|int, DiscussionTopic>
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Tags
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
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
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
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
Return values
FeatureFlagfeatureFlags()
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
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
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
Return values
selfget()
Fetch all courses
public
static get([array<string|int, mixed> $params = [] ]) : array<string|int, Course>
Parameters
- $params : array<string|int, mixed> = []
Tags
Return values
array<string|int, Course>getAccountId()
public
getAccountId() : int
Return values
intgetActiveEnrollments()
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
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
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
Return values
array<string|int, mixed> —Activity stream summary data
getBannerImageId()
public
getBannerImageId() : int|null
Return values
int|nullgetBannerImageUrl()
public
getBannerImageUrl() : string|null
Return values
string|nullgetBlueprintRestrictions()
public
getBlueprintRestrictions() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetBlueprintRestrictionsByObjectType()
public
getBlueprintRestrictionsByObjectType() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetBulkUserProgress()
Get bulk user progress for all users in this course
public
getBulkUserProgress() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Array of user progress data
getCalendar()
public
getCalendar() : CalendarLink|null
Return values
CalendarLink|nullgetCourseCode()
public
getCourseCode() : string
Return values
stringgetCourseColor()
public
getCourseColor() : string|null
Return values
string|nullgetCourseCopyStatus()
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
Return values
array<string|int, mixed> —Course copy status
getCourseFormat()
public
getCourseFormat() : string
Return values
stringgetCourseProgress()
public
getCourseProgress() : CourseProgress|null
Return values
CourseProgress|nullgetCreatedAt()
public
getCreatedAt() : string
Return values
stringgetDefaultDueTime()
public
getDefaultDueTime() : string
Return values
stringgetDefaultView()
public
getDefaultView() : string
Return values
stringgetDesignerEnrollments()
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
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
Return values
array<string|int, mixed> —Effective due dates data
getEndAt()
public
getEndAt() : string|null
Return values
string|nullgetEnrollments()
public
getEnrollments() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetEnrollmentsData()
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|nullgetFriendlyName()
public
getFriendlyName() : string|null
Return values
string|nullgetGradebookHistoryDays()
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
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
Return values
array<string|int, GradebookHistoryGrader>getGradePassbackSetting()
public
getGradePassbackSetting() : string|null
Return values
string|nullgetGradingPeriods()
public
getGradingPeriods() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetGradingStandardId()
public
getGradingStandardId() : int|null
Return values
int|nullgetId()
public
getId() : int
Return values
intgetImageId()
public
getImageId() : int|null
Return values
int|nullgetImageUrl()
public
getImageUrl() : string|null
Return values
string|nullgetIntegrationId()
public
getIntegrationId() : string|null
Return values
string|nullgetLastReport()
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
Return values
CourseReports —Last report instance with status
getLicense()
public
getLicense() : string|null
Return values
string|nullgetLocale()
public
getLocale() : string|null
Return values
string|nullgetLtiContextId()
public
getLtiContextId() : string|null
Return values
string|nullgetName()
public
getName() : string
Return values
stringgetNeedsGradingCount()
public
getNeedsGradingCount() : int|null
Return values
int|nullgetObserverEnrollments()
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
Return values
array<string|int, Enrollment> —Array of observer Enrollment objects
getOriginalName()
public
getOriginalName() : string|null
Return values
string|nullgetPermissions()
public
getPermissions() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetPublicDescription()
public
getPublicDescription() : string|null
Return values
string|nullgetRecentStudents()
Get recently logged in students in this course
public
getRecentStudents() : array<string|int, mixed>
Tags
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
Return values
CourseReports —Report instance with current status
getRootAccountId()
public
getRootAccountId() : int
Return values
intgetSettings()
Get course settings
public
static getSettings(int $courseId) : array<string|int, mixed>
Parameters
- $courseId : int
Tags
Return values
array<string|int, mixed> —Course settings array
getSisCourseId()
public
getSisCourseId() : string|null
Return values
string|nullgetSisImportId()
public
getSisImportId() : int|null
Return values
int|nullgetStartAt()
public
getStartAt() : string|null
Return values
string|nullgetStorageQuotaMb()
public
getStorageQuotaMb() : int
Return values
intgetStorageQuotaUsedMb()
public
getStorageQuotaUsedMb() : int
Return values
intgetStudentCount()
Get the count of student enrollments in this course
public
getStudentCount() : int
Tags
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
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
Return values
array<string|int, mixed> —Array of student data
getSyllabusBody()
public
getSyllabusBody() : string|null
Return values
string|nullgetTaEnrollments()
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
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
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
Return values
array<string|int, Enrollment> —Array of teacher Enrollment objects
getTerm()
public
getTerm() : Term|null
Return values
Term|nullgetTestStudent()
Get or create a test student for this course
public
getTestStudent() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Test student user data
getTimetable()
Get course timetable
public
getTimetable() : array<string, mixed>
Tags
Return values
array<string, mixed>getTimeZone()
public
getTimeZone() : string
Return values
stringgetTodoItems()
Get current user's course-specific TODO items
public
getTodoItems() : array<string|int, mixed>
Tags
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
Return values
int —Total number of enrollments (with optional filters)
getTotalStudents()
public
getTotalStudents() : int|null
Return values
int|nullgetUser()
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
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
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
Return values
array<string|int, mixed> —Array of user data
getUuid()
public
getUuid() : string
Return values
stringgetWorkflowState()
public
getWorkflowState() : string
Return values
stringgradebookHistory()
Get a GradebookHistory instance configured for this course.
public
gradebookHistory() : GradebookHistory
Tags
Return values
GradebookHistorygroupCategories()
Get group categories in this course
public
groupCategories([array<string, mixed> $params = [] ]) : array<string|int, GroupCategory>
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Tags
Return values
array<string|int, GroupCategory>groupCategoriesPaginated()
Get paginated group categories in this course
public
groupCategoriesPaginated([array<string, mixed> $params = [] ]) : PaginatedResponse
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Tags
Return values
PaginatedResponsegroups()
Get groups in this course
public
groups([array<string, mixed> $params = [] ]) : array<string|int, Group>
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Tags
Return values
array<string|int, Group>groupsPaginated()
Get paginated groups in this course
public
groupsPaginated([array<string, mixed> $params = [] ]) : PaginatedResponse
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Tags
Return values
PaginatedResponsehasStudentEnrolled()
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
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
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
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
Return values
ContentMigrationimportOutcomes()
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
Return values
OutcomeImportimportOutcomesFromData()
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
Return values
OutcomeImportimportZipFile()
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
Return values
ContentMigrationisAccessRestrictedByDate()
public
isAccessRestrictedByDate() : bool
Return values
boolisAllowStudentAssignmentEdits()
public
isAllowStudentAssignmentEdits() : bool
Return values
boolisAllowStudentForumAttachments()
public
isAllowStudentForumAttachments() : bool
Return values
boolisAllowWikiComments()
public
isAllowWikiComments() : bool
Return values
boolisApplyAssignmentGroupWeights()
public
isApplyAssignmentGroupWeights() : bool
Return values
boolisBlueprint()
public
isBlueprint() : bool
Return values
boolisConcluded()
public
isConcluded() : bool|null
Return values
bool|nullisConditionalRelease()
public
isConditionalRelease() : bool
Return values
boolisEnableCoursePaces()
public
isEnableCoursePaces() : bool
Return values
boolisHideFinalGrades()
public
isHideFinalGrades() : bool
Return values
boolisHomeroomCourse()
public
isHomeroomCourse() : bool
Return values
boolisOpenEnrollment()
public
isOpenEnrollment() : bool
Return values
boolisPostManually()
public
isPostManually() : bool|null
Return values
bool|nullisPublic()
public
isPublic() : bool
Return values
boolisPublicSyllabus()
public
isPublicSyllabus() : bool
Return values
boolisPublicSyllabusToAuth()
public
isPublicSyllabusToAuth() : bool
Return values
boolisPublicToAuthUsers()
public
isPublicToAuthUsers() : bool
Return values
boolisRestrictEnrollmentsToCourseDates()
public
isRestrictEnrollmentsToCourseDates() : bool
Return values
boolisSelfEnrollment()
public
isSelfEnrollment() : bool
Return values
boolisSyllabusCoursesSummary()
public
isSyllabusCoursesSummary() : bool
Return values
boolisTemplate()
public
isTemplate() : bool
Return values
boolisUseBlueprintRestrictionsByObjectType()
public
isUseBlueprintRestrictionsByObjectType() : bool
Return values
boollinkOutcome()
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
Return values
OutcomeLinkmediaAttachments()
Get media attachments for this course
public
mediaAttachments([array<string, mixed> $params = [] ]) : array<string|int, MediaObject>
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Tags
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
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
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
Return values
array<int, OutcomeGroup> —Array of OutcomeGroup objects
outcomeImportStatus()
Get outcome import status for this course
public
outcomeImportStatus(int|string $importId) : OutcomeImport
Parameters
- $importId : int|string
-
Import ID or 'latest'
Tags
Return values
OutcomeImportoutcomeLinks()
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
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
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
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
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
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
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
Return values
array<string|int, Page>paginate()
Get paginated results with metadata
public
static paginate([array<string, mixed> $params = [] ]) : PaginationResult
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Return values
PaginationResultpaginateRaw()
Fetch courses with pagination support
public
static paginateRaw([array<string, mixed> $params = [] ]) : PaginatedResponse
Parameters
- $params : array<string, mixed> = []
-
Query parameters for the request
Tags
Return values
PaginatedResponsepermissions()
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
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
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
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
Return values
boolreset()
Deletes the current course, and creates a new equivalent course with no content, but all sections and users moved over
public
reset() : self
Tags
Return values
selfrubrics()
Get rubrics for this course
public
rubrics([array<string, mixed> $params = [] ]) : array<string|int, Rubric>
Parameters
- $params : array<string, mixed> = []
-
Query parameters
Tags
Return values
array<string|int, Rubric>save()
Save the course to the Canvas LMS system
public
save() : self
Tags
Return values
selfsearchContentShareUsers()
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
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
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
Return values
ContentMigrationsetAccessRestrictedByDate()
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
setApiClient()
Set the API client
public
static setApiClient(HttpClientInterface $apiClient) : void
Parameters
- $apiClient : HttpClientInterface
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
setCalendar()
public
setCalendar(CalendarLink|null $calendar) : void
Parameters
- $calendar : CalendarLink|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
setCourseFormat()
public
setCourseFormat(string $courseFormat) : void
Parameters
- $courseFormat : string
setCourseProgress()
public
setCourseProgress(CourseProgress|null $courseProgress) : void
Parameters
- $courseProgress : CourseProgress|null
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
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
setFeatureFlag()
Update a feature flag for this course.
public
setFeatureFlag(string $featureName, array<string, mixed>|UpdateFeatureFlagDTO $data) : FeatureFlag
Parameters
- $featureName : string
-
The symbolic name of the feature
- $data : array<string, mixed>|UpdateFeatureFlagDTO
-
Update data
Tags
Return values
FeatureFlagsetFriendlyName()
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
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
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
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
Return values
array<int, array<string, mixed>> —Array of student summaries
tabs()
Get tabs for this course
public
tabs() : array<string|int, Tab>
Tags
Return values
array<string|int, Tab>update()
Update an existing course
public
static update(int $id, UpdateCourseDTO|array<string|int, mixed> $courseData) : self
Parameters
- $id : int
- $courseData : UpdateCourseDTO|array<string|int, mixed>
Tags
Return values
selfupdateSettings()
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
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
Return values
DateTime|mixedcheckApiClient()
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>createConfiguredHttpClient()
Create an HttpClient with configured middleware
protected
static createConfiguredHttpClient() : HttpClient
Return values
HttpClientcreatePaginationResult()
Helper method to create PaginationResult from paginated response
protected
static createPaginationResult(PaginatedResponse $paginatedResponse) : PaginationResult
Parameters
- $paginatedResponse : PaginatedResponse
Return values
PaginationResultgetEndpoint()
Get the API endpoint for this resource
protected
static getEndpoint() : string
Return values
stringgetPaginatedResponse()
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
PaginatedResponsepopulate()
Populate the object with new data
protected
populate(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
Tags
toDtoArray()
Convert the object to an array for DTO operations
protected
toDtoArray() : array<string|int, mixed>
Return values
array<string|int, mixed>createFromDTO()
Create a new Course instance from a CreateCourseDTO
private
static createFromDTO(CreateCourseDTO $dto) : self
Parameters
- $dto : CreateCourseDTO
Tags
Return values
selfupdateFromDTO()
Update an existing course from a UpdateCourseDTO
private
static updateFromDTO(int $id, UpdateCourseDTO $dto) : self
Parameters
- $id : int
- $dto : UpdateCourseDTO