saccas/hitobito-json-api-model
最新稳定版本:v2.0.0
Composer 安装命令:
composer require saccas/hitobito-json-api-model
包简介
README 文档
README
PHP model for the Hitobito API. This model was automatically generated on the basis of the OpenAPI specification and requires the abstract saccas/json-api-model.
Installation
Extend your composer.json
{
"repositories": [
{
"type": "git",
"url": "git@github.com:saccas/json-api-model.git"
},
{
"type": "git",
"url": "git@github.com:saccas/hitobito-json-api-model.git"
}
]
}
Require this package:
composer require saccas/hitobito-json-api-model @dev
Usage
<?php require __DIR__.'/vendor/autoload.php'; $baseUri = 'https://sac-cas.puzzle.ch'; $defaultHeaders = [ 'X-TOKEN' => '…', ]; $hitobitoApi = new \Saccas\HitobitoApi\HitobitoApi(new \GuzzleHttp\Client(), $baseUri, $defaultHeaders); $coursesRepository = $hitobitoApi->getCoursesRepository(); $allCourses = $coursesRepository->getAll(); foreach($allCourses as $course) { echo $course->getId() . ' ' . $course->getName() . "\n"; echo 'Location: ' . $course->getLocation() . "\n"; echo 'Start: ' . $course->getDates()->get(0)->getStartAt()->format('Y-m-d') . "\n"; $contact = $course->getContact(); if (isset($contact)) { echo 'Contact: ' . $contact->getFirstName() . ' ' . $contact->getLastName() . "\n"; } echo 'Accommodation: ' . $course->getAccommodation() . "\n"; echo "\n"; }
统计信息
- 总下载量: 494
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2024-09-30