{"id":26849600,"url":"https://github.com/ziming/laravel-scrapingbee","last_synced_at":"2025-04-07T19:16:13.234Z","repository":{"id":40645781,"uuid":"398549625","full_name":"ziming/laravel-scrapingbee","owner":"ziming","description":"A PHP Laravel Library for Scrapingbee Web Scraping API","archived":false,"fork":false,"pushed_at":"2025-04-05T15:51:30.000Z","size":86,"stargazers_count":29,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-05T16:33:21.333Z","etag":null,"topics":["ai","artificial-intelligence","hacktoberfest","laravel","llm","llm-training","llms","php","scraping","scraping-bee","scrapingbee","scrapingbee-api","web-scraping","webscraping"],"latest_commit_sha":null,"homepage":"https://www.scrapingbee.com/?fpr=php-laravel","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ziming.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ziming"}},"created_at":"2021-08-21T12:15:06.000Z","updated_at":"2025-04-05T15:51:33.000Z","dependencies_parsed_at":"2024-04-21T06:26:42.524Z","dependency_job_id":"6623ca2f-6db0-4ef2-84d7-1ec10305d727","html_url":"https://github.com/ziming/laravel-scrapingbee","commit_stats":{"total_commits":64,"total_committers":4,"mean_commits":16.0,"dds":0.640625,"last_synced_commit":"063c9d21be2113e3f8af1a763e9a70f9be1e1e1c"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":"spatie/package-skeleton-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziming%2Flaravel-scrapingbee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziming%2Flaravel-scrapingbee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziming%2Flaravel-scrapingbee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziming%2Flaravel-scrapingbee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ziming","download_url":"https://codeload.github.com/ziming/laravel-scrapingbee/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369470,"owners_count":20927920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","artificial-intelligence","hacktoberfest","laravel","llm","llm-training","llms","php","scraping","scraping-bee","scrapingbee","scrapingbee-api","web-scraping","webscraping"],"created_at":"2025-03-30T21:36:47.931Z","updated_at":"2025-04-07T19:16:13.223Z","avatar_url":"https://github.com/ziming.png","language":"PHP","funding_links":["https://github.com/sponsors/ziming"],"categories":[],"sub_categories":[],"readme":"# A PHP Laravel Library for [ScrapingBee](https://www.scrapingbee.com?fpr=php-laravel)\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/ziming/laravel-scrapingbee.svg?style=flat-square)](https://packagist.org/packages/ziming/laravel-scrapingbee)\n[![Total Downloads](https://img.shields.io/packagist/dt/ziming/laravel-scrapingbee.svg?style=flat-square)](https://packagist.org/packages/ziming/laravel-scrapingbee)\n\nA PHP Laravel Package for [ScrapingBee](https://www.scrapingbee.com?fpr=php-laravel)\n\nIf you wanted to support my work you can use my [referral link to create an account \u0026 be a paid customer of ScrapingBee](https://www.scrapingbee.com?fpr=php-laravel).\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require ziming/laravel-scrapingbee\n```\n\nYou can publish the config file with:\n```bash\nphp artisan vendor:publish --provider=\"Ziming\\LaravelScrapingBee\\LaravelScrapingBeeServiceProvider\" --tag=\"laravel-scrapingbee-config\"\n```\n\nThis is the contents of the published config file:\n\n```php\nreturn [\n    'api_key' =\u003e env('SCRAPINGBEE_API_KEY'),\n    'base_url' =\u003e env('SCRAPINGBEE_BASE_URL', 'https://app.scrapingbee.com/api/v1/'),\n    'timeout' =\u003e env('SCRAPINGBEE_TIMEOUT', 120),\n];\n```\n\n## Usage\n\n### The Generic ScrapingBee Client\n\n```php\n$scrapingBeeClient = Ziming\\LaravelScrapingBee\\LaravelScrapingBee::make();\n\n$response = $scrapingBeeClient-\u003eblockAds()\n    -\u003ewhen(now()-\u003eweekOfMonth === 4, function (LaravelScrapingBee $scrapingBeeClient): LaravelScrapingBee {\n        // if it is last week of the month, spam premium proxy to use up credits!\n        return $scrapingBeeClient-\u003epremiumProxy();\n    })\n    -\u003ejsonResponse()\n    //-\u003eaiQuery('top 5 blog posts') // AI Query Feature!\n    //-\u003eaiExtractRules(['title' =\u003e 'title of post', 'summary' =\u003e 'summary of post']) // AI Extract Feature!\n    -\u003ejsScenario([\n        ['click' =\u003e '#button_id'],\n        ['wait' =\u003e 1000],\n        ['wait_for' =\u003e '#slow_div'],\n        ['scroll_x' =\u003e 1000],\n        ['scroll_y' =\u003e 1000],\n        ['fill' =\u003e ['#input_1','value_1']],\n        ['evaluate' =\u003e 'console.log(window);'],\n])-\u003eget('https://www.scrapingbee.com')\n```\n\nLook at the source code of `src/LaravelScrapingBee.php` for the other methods (link below). Methods that return `$this` are chainable. An example is the `blockAds()` method you saw above. Meanwhile methods such as `get()`, `post()`, `usageStatistics()` returns you an `Illuminate\\Http\\Client\\Response` object if no exceptions are thrown.\n\n[LaravelScrapingBee.php](https://github.com/ziming/laravel-scrapingbee/blob/main/src/LaravelScrapingBee.php)\n\nIf for some reason you prefer to set all parameters at once you may wish to use the `setParams() or addParams()` method. Take note that these methods simply takes in an array and sets the parameters as is. So for the methods that does something extra before setting the parameter you would have to do them yourselves now if you chose this path.\n\nAn example is shown below:\n\n```php\n$scrapingBeeClient = Ziming\\LaravelScrapingBee\\LaravelScrapingBee::make();\n\n$response = $scrapingBeeClient-\u003esetParams([\n        'js_scenario' =\u003e json_encode([\n            'instructions' =\u003e [\n                ['click' =\u003e '#button_id'],\n                ['wait' =\u003e 1000],\n                ['wait_for' =\u003e '#slow_div'],\n                ['scroll_x' =\u003e 1000],\n                ['scroll_y' =\u003e 1000],\n                ['fill' =\u003e ['#input_1','value_1']],\n                ['evaluate' =\u003e 'console.log(window);']\n            ]\n        ]),\n        'block_ads' =\u003e true,\n        'json_response' =\u003e true,\n    ])-\u003eget('https://www.scrapingbee.com')\n```\n\n### The Google Search ScrapingBee Client\n\n```php\n$googleSearchScrapingBeeClient = Ziming\\LaravelScrapingBee\\LaravelScrapingBeeGoogleSearch::make();\n\n$response = $googleSearchScrapingBeeClient\n    -\u003enbResults(8)\n    -\u003epage(1)\n    -\u003esearch('scrapingbee')\n    -\u003eget();\n```\nLook at the source code of `src/LaravelScrapingBeeGoogleSearch.php` for the other methods (link below).\n\n[LaravelScrapingBeeGoogleSearch.php](https://github.com/ziming/laravel-scrapingbee/blob/main/src/LaravelScrapingBeeGoogleSearch.php)\n\n## Testing\n\nCurrently, there are no tests. But if there are tests in the future, you can run the command below to execute the testcases.\n\n```bash\ncomposer test\n```\n\n## Contributing\n\nYou may see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Ziming](https://github.com/ziming)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziming%2Flaravel-scrapingbee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fziming%2Flaravel-scrapingbee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziming%2Flaravel-scrapingbee/lists"}