Download the PHP package as-cornell/as_courses without Composer
On this page you can find all versions of the php package as-cornell/as_courses. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download as-cornell/as_courses
More information about as-cornell/as_courses
Files in as-cornell/as_courses
Package as_courses
Short Description Provides lists of courses pulled from the Cornell course roster API by subject and semester.
License GPL-3.0-or-later
Homepage https://communications.as.cornell.edu
Informations about the package as_courses
AS COURSES (as_courses)
INTRODUCTION
A Drupal module that provides lists of courses pulled from the Cornell course roster API (classes.cornell.edu) by subject and semester. Built with service-oriented architecture and dependency injection for Drupal 10/11 best practices.
Features
- Dynamic Semester Generation - Semesters auto-generate based on current year (no more manual updates!)
- Service-Based API Client - Proper HTTP client with error handling and logging
- Twig Functions - Multiple Twig functions for displaying course data in templates
- Courses Controller - Route to display all courses for selected subjects/semesters
- Settings Form - Configure semesters, subjects, and defaults via admin UI
- Fully Testable - Comprehensive unit and functional tests
- Cached Responses - API responses cached for performance (configurable duration)
Architecture (v2.0+)
- Services: Core business logic in injectable services
CoursesApiService- Cornell Classes API clientSemesterGeneratorService- Dynamic semester list generation
- Dependency Injection: All components use proper DI (no static calls)
- Error Handling: Comprehensive logging via dedicated logger channel
- Configuration: Schema-based configuration with install defaults
REQUIREMENTS
- Drupal 10.0 or higher
- PHP 8.1 or higher
- Internet access to Cornell Classes API (classes.cornell.edu)
INSTALLATION
Install as you would normally install a contributed Drupal module. See Installing Drupal Modules for further information.
CONFIGURATION
Admin Settings
Configure the module at: /admin/config/content/as_courses
Settings:
- Semesters to display - Select which semesters appear in tabs (checkboxes)
- Default semester - Which semester loads at
/coursesroute - Course Prefixes - Comma-separated list (e.g.,
PSYCH,ECON,HIST)
Advanced Configuration
Edit /admin/config/development/configuration or add to settings.php:
USAGE
Twig Functions
All Twig functions available in templates:
1. Display Courses by Subject
2. Display Courses by Instructor (NetID)
3. Get Current Semesters
4. Format Semester Names
5. Person's Courses by Subject
6. Person's Courses Filtered by Subjects
Using Services in Custom Code
API Service:
Semester Generator Service:
Controller Route
Visit /courses or /courses/{semester} to see the default courses page (uses courses.html.twig template).
Example:
/courses- Displays default semester/courses/SP26- Displays Spring 2026 courses/courses/FA25- Displays Fall 2025 courses
TESTING
Run Unit Tests
Run Functional Tests
Manual Testing Checklist
- [ ] Visit
/admin/config/content/as_courses- Form loads with dynamic semesters - [ ] Save settings form - No errors, config saves
- [ ] Visit
/courses- Page loads with default semester - [ ] Visit
/courses/SP26- Page loads with specified semester - [ ] Use Twig functions in template - Course data displays correctly
- [ ] Check logs:
drush watchdog:show --type=as_courses- API calls logged - [ ] Check cache: Course data cached properly
TROUBLESHOOTING
No Courses Appearing
-
Check API connectivity:
-
Check module logs:
-
Clear cache:
- Verify configuration:
Semester List Not Updating
- Dynamic semester generation added in v2.0.0
- Clear cache:
drush cr - Adjust year range in
as_courses.settingsconfig
Deprecated Function Warnings
If you see deprecation warnings:
Update your code to use the service:
CHANGELOG
See CHANGELOG.md for version history and upgrade notes.
MAINTAINERS
Current maintainers for Drupal 10/11:
- Mark Wilson (markewilson)
Contributing
- Report bugs and feature requests in the issue queue
- Follow Drupal coding standards
- Include tests with code changes
- See CHANGELOG.md for architecture details