php-extended/php-coursgratuit-com-api

This package is abandoned and no longer maintained. The author suggests using the php-extended/php-api-com-coursgratuit-object package instead.

A php API wrapper to connect to coursgratuit.com website


README

A php API wrapper to connect to coursgratuit.com website.

coverage build status

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.json :

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

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

Basic Usage

You may use this library the following way :


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
	}
}

License

MIT (See license file).