php-extended/php-api-com-coursgratuit-object

该包已被废弃且不再维护。未建议替代包。

一个实现php-extended/php-api-com-coursgratuit-interface库的库


README

一个连接到coursgratuit.com网站的php API包装器。

coverage build status

安装

该库的安装通过composer完成。从他们的网站下载composer.phar。然后将其添加到你的composer.json

	"require": {
		...
		"php-extended/php-api-com-coursgratuit-object": "^3",
		...
	}

然后运行php composer.phar update来安装此库。此库中所有类的自动加载都通过composer的自动加载器完成。

基本用法

你可以使用此库的方式如下


use PhpExtended\CoursgratuitCom\CoursgratuitComEndpoint;

/* @var $cleint         \Psr\Http\Client\ClientInterface          */
/* @var $uriFactory     \Psr\Http\Message\UriFactoryInterface     */
/* @var $requestFactory \Psr\Http\Message\RequestFactoryInterface */
/* @var $slugifier      \PhpExtended\Slugifier\SlugifierInterface */

$endpoint = new CoursgratuitComEndpoint($client, $uriFactory, $requestFactory, $slugifier);

foreach($endpoint->getRootCategoryList() as $category1)
{
	foreach($endpoint->getCategoryList($category1) as $category2)
	{
		foreach($endpoint->getCategoryList($category2) as $category3)
		{
			foreach($endpoint->getCoursIdIterator($category3) as $coursId)
			{
				$cours = $endpoint->getCours($coursId);
				$file = $endpoint->getCoursFileData($cours);
				// do stgh with file
			}
		}
		
		foreach($endpoint->getCoursIdIterator($category2) as $coursId)
		{
			$cours = $endpoint->getCours($coursId);
			$file = $endpoint->getCoursFileData($cours);
			// do stgh with file
		}
	}
	
	foreach($endpoint->getCoursIdIterator($category1) as $coursId)
	{
		$cours = $endpoint->getCours($coursId);
		$file = $endpoint->getCoursFileData($cours);
		// do stgh with file
	}
}

许可证

MIT (见许可证文件)。