{"id":20555253,"url":"https://github.com/nicolasmure/crawlerdetectbundle","last_synced_at":"2025-07-30T09:05:39.822Z","repository":{"id":54916837,"uuid":"74612510","full_name":"nicolasmure/CrawlerDetectBundle","owner":"nicolasmure","description":"A Symfony bundle for the Crawler-Detect library (detects bots/crawlers/spiders via the user agent)","archived":false,"fork":false,"pushed_at":"2021-01-21T07:59:39.000Z","size":13,"stargazers_count":25,"open_issues_count":2,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-20T18:43:10.657Z","etag":null,"topics":["bot","bundle","crawler","php","symfony"],"latest_commit_sha":null,"homepage":"","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/nicolasmure.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-23T20:42:53.000Z","updated_at":"2023-01-11T11:12:45.000Z","dependencies_parsed_at":"2022-08-14T06:31:18.534Z","dependency_job_id":null,"html_url":"https://github.com/nicolasmure/CrawlerDetectBundle","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/nicolasmure/CrawlerDetectBundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasmure%2FCrawlerDetectBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasmure%2FCrawlerDetectBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasmure%2FCrawlerDetectBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasmure%2FCrawlerDetectBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicolasmure","download_url":"https://codeload.github.com/nicolasmure/CrawlerDetectBundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasmure%2FCrawlerDetectBundle/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267842979,"owners_count":24153133,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bot","bundle","crawler","php","symfony"],"created_at":"2024-11-16T03:17:21.305Z","updated_at":"2025-07-30T09:05:39.757Z","avatar_url":"https://github.com/nicolasmure.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CrawlerDetectBundle\n\n[![Build Status](https://travis-ci.org/nicolasmure/CrawlerDetectBundle.svg?branch=master)](https://travis-ci.org/nicolasmure/CrawlerDetectBundle)\n[![Coverage Status](https://coveralls.io/repos/github/nicolasmure/CrawlerDetectBundle/badge.svg?branch=master)](https://coveralls.io/github/nicolasmure/CrawlerDetectBundle?branch=master)\n\nA Symfony bundle for the [Crawler-Detect](https://github.com/JayBizzle/Crawler-Detect \"JayBizzle/Crawler-Detect\")\nlibrary (detects bots/crawlers/spiders via the user agent).\n\n## Table of contents\n\n- [Introduction](#introduction)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Testing](#testing)\n\n## Introduction\n\nThis Bundle integrates the [Crawler-Detect](https://github.com/JayBizzle/Crawler-Detect \"JayBizzle/Crawler-Detect\")\nlibrary into Symfony.\nIt is **recommended** to read the lib's documentation before continuing here.\n\nThe aim of this bundle is to expose the [`CrawlerDetect`](https://github.com/JayBizzle/Crawler-Detect/blob/master/src/CrawlerDetect.php \"Jaybizzle\\CrawlerDetect\\CrawlerDetect\")\nclass as a service (`crawler_detect`) to make it easier to use with Symfony\n(dependency injection, usable from a controller, etc...).\n\n## Installation\n\nDownload the bundle using composer :\n\n```bash\n$ composer require nmure/crawler-detect-bundle \"^2.0.0\"\n```\n\nFor Symfony \u003c 4.0, run :\n\n```bash\n$ composer require nmure/crawler-detect-bundle \"^1.0.0\"\n```\n\nthen enable the bundle in your AppKernel :\n\n```php\n// app/AppKernel.php\nclass AppKernel extends Kernel\n{\n    public function registerBundles()\n    {\n        $bundles = array(\n            // ...\n            new Nmure\\CrawlerDetectBundle\\CrawlerDetectBundle(),\n            // ...\n        );\n    }\n}\n```\n\n## Usage\n\nThe `crawler_detect` service is initialized with the data from\nthe Symfony's master request.\n\nTo use this service from a controller :\n\n```php\npublic function indexAction()\n{\n    if ($this-\u003eget('crawler_detect')-\u003eisCrawler()) {\n        // this request is from a crawler :)\n    }\n\n    // you can also specify an user agent if you don't want\n    // to use the one of the master request or if the app\n    // is accessed by the CLI :\n    $ua = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';\n    if ($this-\u003eget('crawler_detect')-\u003eisCrawler($ua)) {\n        // this user agent belongs to a crawler :)\n    }\n}\n```\n\nYou can also inject this service as a dependency\nusing the `crawler_detect` service id.\n\n## Testing\n\n```bash\n$ docker run --rm -v `pwd`:/app phpunit/phpunit -c /app\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolasmure%2Fcrawlerdetectbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicolasmure%2Fcrawlerdetectbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolasmure%2Fcrawlerdetectbundle/lists"}