louisperre/composer-td3
最新稳定版本:1.0.3
Composer 安装命令:
composer require louisperre/composer-td3
包简介
Scrap the TMDB website to get all sort of data
README 文档
README
Information
Easily scrap the TMDB website
Features
- Scrap all the movies categories name
- Scrap all the movies categories slug
- Scrap all the movies related to a category
- Scrap all the data of a movie
Work without any api key
🔥 Installation 🔥
composer require louisperre/composer-td3
⚙️ Usage ⚙️
<?php use louisperr/ApiTmdb; $api = new ApiTmdb(); $categories = $api->getNameCategories() // array
✨ How does that work ? ✨
I use the HttpClient from Symfony to get the HTTP Code of TMDB :
$client = HttpClient::create(); $response = $client->request( 'GET', 'url' ); $content = $response->getContent();
After that I use the Crawler to find and loop over the content and get what I want :
$crawler = new Crawler($content); $list = $crawler ->filter('CSS SELECTOR') ->reduce(function (Crawler $node, $i) use (&$array) : bool { foreach ($node->filter('selector') as $something) { // Do something } })
The filter function allow me to navigate inside the HTML CODE and the reduce one act as a callback function to do some logic to the result and the result I want.
🔧 Local development 🔧
# Install the dependencies
composer install
# Test the type of all the project
php vendor/bin/phpstan analyze src --level=max
# Execute all the test
php vendor/bin/phpunit --testdox tests
📝 License 📝
Licensed under the terms of the MIT License.
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-05