pbxg33k/flaresolverr-bundle
最新稳定版本:0.0.3
Composer 安装命令:
composer require pbxg33k/flaresolverr-bundle
包简介
A Symfony bundle to easily make use of FlareSolverr
README 文档
README
FlareSolverrBundle
This Symfony bundle provides an easy way to integrate the FlareSolverr proxy service into your Symfony applications. FlareSolverr is a proxy server to bypass Cloudflare's anti-bot page, allowing you to scrape websites protected by Cloudflare.
Installation
============
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
composer require pbxg33k/flaresolverr-bundle
Applications that don't use Symfony Flex
Step 1: Create the bundle config file (for now)
Create a file named flare_solverr.yaml in the config/packages/ directory of your Symfony project.
This file will contain the configuration for the FlareSolverrBundle.
# config/packages/flare_solverr.yaml flare_solverr: # The URL of the FlareSolverr server url: 'http://localhost:8191' # note that this url lacks the '/v1' suffix, which is added automatically by the bundle ### Optional session: id: 'fixed-session-id' # Optional: If you want to use a fixed session ID, set it here ttl_timeout: 3600 # Optional: Set a custom TTL for the session in seconds (default is 3600 seconds)
Step 2: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
composer require pbxg33k/flaresolverr-bundle
Step 3: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php file of your project:
// config/bundles.php return [ // ... Pbxg33k\FlareSolverrBundle\FlareSolverrBundle::class => ['all' => true], ];
Usage
To use the FlareSolverrBundle, you can inject the FlareSolverrClient service into your controllers or services.
Here's an example of how to use it in a controller:
// src/Controller/ExampleController.php namespace App\Controller; use Pbxg33k\FlareSolverrBundle\Client\FlareSolverrClient; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; class ExampleController extends AbstractController { public function __construct( private(set) FlareSolverrClient $flareSolverrClient ) { } public function index(): Response { $response = $this->flareSolverrClient->requestGet('https://example.com'); $HTMLContentAsString = $response->getResponseContent(); $HTMLDocumentAsDOMDocument = $response->getResponseContentAsHTMLDocument(); // Do your magic with the response here } }
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-23