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
3.1.9
2021-01-03 13:34 UTC
Requires
Requires (Dev)
- php-extended/php-basic-console-logger: ^3
- php-extended/php-css-selector-parser-object: ^4
- php-extended/php-html-parser-object: ^4
- php-extended/php-html-transformer-factory-object: ^3
- php-extended/php-http-client-factory-object: ^3
- php-extended/php-slugifier-factory-object: ^3
- php-extended/placeholder-phpunit: >=1
README
A php API wrapper to connect to coursgratuit.com website.
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).