hurah/canvas-api
Composer 安装命令:
composer require hurah/canvas-api
包简介
A set of classes that helps with communicating with the Instructure Canvas API.
README 文档
README
This library is a PHP SDK for the Instructure Canvas API, designed to simplify communication with Canvas by providing statically typed classes for most API endpoints. It supports both collection and single entity operations. The SDK is still in development but is already being used in small production environments. .
Features
- Statically typed classes: Provides typed classes for most API endpoints.
- Collections and entities: Easily handle both collections and single entities in a clean object-oriented manner implementing php's Iterator and ArrayAccess interfaces.
- Centralized communication: All communication goes through an instance of the
Canvasobject. - Symfony Console Commands: Includes commands for manual communication with the API, offering examples, excellent documentation and testing tools.
Installation
Install the package via Composer:
composer require hurah/canvas-api
Usage
Basic Setup
Create an instance of the Canvas object and authenticate with your API credentials:
use Hurah\CanvasApi\Canvas; $canvas = new Canvas('your-api-url', 'your-access-token');
Fetching Data
Example: fetch a collection
use Hurah\CanvasApi\Canvas; $oCourseCollection = $canvas->getCourses(); foreach ($oCourseCollection as $oCourse) { echo $oCourse->getName(); }
Example: Single Entity
$oCourse = $canvas->getCourse(123); echo $course->getName();
Example: Create a new Course
$oCourse = new Course(); $oCourse->setName('Some name'); $oCourse->setDescription('Some description'); $oCourse->setSomeOtherProperty('...') $oCourse = $canvas->createCourse($oCourse); // The same object is returned containing the course // id and other default properties. $oCourse->getId()
Contributing
Contributions and feedback are welcome! Please keep in mind that this software is in beta and comes as is. Use it at your own risk.
- Fork the repository.
- Create your feature branch: git checkout -b feature/my-new-feature.
- Commit your changes: git commit -m 'Add some feature'.
- Push to the branch: git push origin feature/my-new-feature.
- Open a pull request.
Links
Author
Anton Boutkam - Teacher Software Development at ROC Amstelland
CicleCI build status
- v1.0.51 attempt to add mastery paths
- v1.0.39 removed print_r
- v1.0.40 added documentation index under
doc/index.md - v1.0.41 added mastery path support (
getModuleItemSequence,selectMasteryPath) with endpoint models, commands, and tests - v1.0.38 exposing lots of new endpoints with codex generated code
- v1.0.23 added ability to get course students
- v1.0.22 upgrade dependencies
- v1.0.21 initialized frozenAttributes in Assignment, was breaking unit testing.
- v1.0.20 upgraded various dependencies
- v1.0.18 improved README.md
- v1.0.17 removed Account part due to insufficient privileges on my Canvas account.
- v1.0.16 added Assignments, AssignmentGroups, CourseCommands, CourseSubmissionCommands, PageCommands, QuizQuestionCommands
- v1.0.15 bugfix Added missing properties to Assignment endpoint
- v1.0.13 bugfix Made setters nullable
- v1.0.12 added Lots of endpoints
- v1.0.11 added Canvas::getUserCourses(int $iCanvasId):CourseCollection
- v1.0.10 added QuizQuestionGetCommand, QuizQuestionListCommand
- v1.0.9 added QuizQuestion
- v1.0.8 updated QuizQuestion
- v1.0.7 updated QuizQuestionGroup
- v1.0.6 updated QuizQuestionGroup
- v1.0.5 updated Quiz
- v1.0.3 added Quiz
hurah/canvas-api 适用场景与选型建议
hurah/canvas-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 359 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 10 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 hurah/canvas-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hurah/canvas-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 359
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-17