master a0339574b6df cached
12 files
9.2 KB
2.6k tokens
13 symbols
1 requests
Download .txt
Repository: JayBizzle/Laravel-Crawler-Detect
Branch: master
Commit: a0339574b6df
Files: 12
Total size: 9.2 KB

Directory structure:
gitextract_9rujszq2/

├── .coveralls.yml
├── .gitignore
├── .styleci.yml
├── .travis.yml
├── LICENSE
├── README.md
├── composer.json
├── phpunit.xml
├── src/
│   ├── Facades/
│   │   └── LaravelCrawlerDetect.php
│   └── LaravelCrawlerDetectServiceProvider.php
└── tests/
    ├── UATests.php
    └── bootstrap.php

================================================
FILE CONTENTS
================================================

================================================
FILE: .coveralls.yml
================================================
service_name: travis-ci


================================================
FILE: .gitignore
================================================
/vendor
composer.phar
composer.lock
.DS_Store


================================================
FILE: .styleci.yml
================================================
preset: none
enabled:
 - array_element_white_space_after_comma
 - blankline_after_open_tag
 - braces
 - concat_without_spaces
 - double_arrow_multiline_whitespaces
 - duplicate_semicolon
 - elseif
 - empty_return
 - encoding
 - eof_ending
 - function_call_space
 - function_declaration
 - include
 - indentation
 - join_function
 - line_after_namespace
 - linefeed
 - list_commas
 - logical_not_operators_with_successor_space
 - short_array_syntax
 - lowercase_constants
 - lowercase_keywords
 - method_argument_space
 - multiline_array_trailing_comma
 - multiline_spaces_before_semicolon
 - multiple_use
 - namespace_no_leading_whitespace
 - no_blank_lines_after_class_opening
 - no_empty_lines_after_phpdocs
 - no_extra_consecutive_blank_lines
 - object_operator
 - operators_spaces
 - ordered_use
 - parenthesis
 - phpdoc_indent
 - phpdoc_inline_tag
 - phpdoc_no_access
 - phpdoc_no_package
 - phpdoc_scalar
 - phpdoc_short_description
 - phpdoc_to_comment
 - phpdoc_trim
 - phpdoc_type_to_var
 - phpdoc_var_without_name
 - remove_leading_slash_use
 - return
 - self_accessor
 - short_echo_tag
 - short_tag
 - single_array_no_trailing_comma
 - single_blank_line_before_namespace
 - single_line_after_imports
 - single_quote
 - spaces_before_semicolon
 - spaces_cast
 - standardize_not_equal
 - ternary_spaces
 - trailing_spaces
 - trim_array_spaces
 - unalign_equals
 - unary_operators_spaces
 - visibility
 - whitespacy_lines

================================================
FILE: .travis.yml
================================================
language: php

matrix:
  include:
    - php: 5.5
    - php: 5.6
    - php: 7.0
    - php: 7.1
    - php: 7.2
    - php: 7.3
    - php: 7.4
    - php: nightly
  allow_failures:
    - php: nightly
  fast_finish: true

before_script:
  - travis_retry composer self-update
  - travis_retry composer install --prefer-source --no-interaction --dev

script: vendor/bin/phpunit


================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2017 Mark Beech

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



================================================
FILE: README.md
================================================
Laravel Crawler Detect
=======
[![Build Status](https://img.shields.io/travis/JayBizzle/Laravel-Crawler-Detect/master.svg?style=flat-square)](https://travis-ci.org/JayBizzle/Laravel-Crawler-Detect) [![Total Downloads](https://img.shields.io/packagist/dt/JayBizzle/Laravel-Crawler-Detect.svg?style=flat-square)](https://packagist.org/packages/jaybizzle/laravel-crawler-detect)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/JayBizzle/Laravel-Crawler-Detect.svg?style=flat-square)](https://scrutinizer-ci.com/g/JayBizzle/Laravel-Crawler-Detect/?branch=master) [![StyleCI](https://styleci.io/repos/32484055/shield)](https://styleci.io/repos/32484055)

A Laravel wrapper for [CrawlerDetect](https://github.com/JayBizzle/Crawler-Detect) - the web crawler detection library

Installation
============

Run `composer require jaybizzle/laravel-crawler-detect 1.*` or add `"jaybizzle/laravel-crawler-detect": "1.*"` to your `composer.json` file.

The last version compatible with Laravel 4 was [v1.0.2](https://github.com/JayBizzle/Laravel-Crawler-Detect/tree/v1.0.2) so if you need that, you will have to fix your `composer.json` to that specific version.

Add the following to the `providers` array in your `config/app.php` file..

```PHP
  Jaybizzle\LaravelCrawlerDetect\LaravelCrawlerDetectServiceProvider::class,
```

...and the following to your `aliases` array...

```PHP
  'Crawler'   => Jaybizzle\LaravelCrawlerDetect\Facades\LaravelCrawlerDetect::class,
```

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

Usage
==================
```PHP
use Crawler;

// Check current 'visitors' user agent
if(Crawler::isCrawler()) {
  // true if crawler user agent detected
}


// Pass a user agent as a string
if(Crawler::isCrawler('Mozilla/5.0 (compatible; aiHitBot/2.9; +https://www.aihitdata.com/about)')) {
  // true if crawler user agent detected
}


================================================
FILE: composer.json
================================================
{
    "name": "jaybizzle/laravel-crawler-detect",
    "description": "A Laravel package to detect web crawlers via the user agent",
    "keywords": ["laravel", "spider", "bot", "detect", "user-agent", "crawler", "crawler detect", "crawler detector", "crawlerdetect", "php crawler detect"],
    "homepage": "http://github.com/JayBizzle/Laravel-Crawler-Detect",
    "license": "MIT",
    "authors": [
        {
            "name": "Mark Beech",
            "email": "mbeech@mark-beech.co.uk"
        }
    ],
    "require": {
        "php": ">=5.4.0",
        "jaybizzle/crawler-detect": "1.*"
    },
    "require-dev": {
        "orchestra/testbench": "^3.2|^3.4",
        "phpunit/phpunit": "^4.8|^5.5|^6.5"
    },
    "autoload": {
        "psr-4": {
            "Jaybizzle\\LaravelCrawlerDetect\\": "src/"
        }
    },
    "extra": {
        "laravel": {
            "providers": [
                "Jaybizzle\\LaravelCrawlerDetect\\LaravelCrawlerDetectServiceProvider"
            ],
            "aliases": {
                "Crawler": "Jaybizzle\\LaravelCrawlerDetect\\Facades\\LaravelCrawlerDetect"
            }
        }
    },
    "minimum-stability": "stable"
}


================================================
FILE: phpunit.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="tests/bootstrap.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         syntaxCheck="false"
>
    <testsuites>
        <testsuite name="Package Test Suite">
            <directory suffix=".php">./tests/</directory>
        </testsuite>
    </testsuites>
</phpunit>


================================================
FILE: src/Facades/LaravelCrawlerDetect.php
================================================
<?php

namespace Jaybizzle\LaravelCrawlerDetect\Facades;

use Illuminate\Support\Facades\Facade;

class LaravelCrawlerDetect extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'LaravelCrawlerDetect';
    }
}


================================================
FILE: src/LaravelCrawlerDetectServiceProvider.php
================================================
<?php

namespace Jaybizzle\LaravelCrawlerDetect;

use Illuminate\Support\ServiceProvider;

class LaravelCrawlerDetectServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        //$this->package('Jaybizzle/LaravelCrawlerDetect');
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('LaravelCrawlerDetect', function () {
            return new \Jaybizzle\CrawlerDetect\CrawlerDetect(request()->server());
        });
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return [];
    }
}


================================================
FILE: tests/UATests.php
================================================
<?php

use Jaybizzle\CrawlerDetect\CrawlerDetect;
use Orchestra\Testbench\TestCase;

class UATests extends TestCase
{
    protected $LaravelCrawlerDetect;

    protected function getPackageProviders($app)
    {
        return ['Jaybizzle\LaravelCrawlerDetect\LaravelCrawlerDetectServiceProvider'];
    }

    protected function getPackageAliases($app)
    {
        return [
            'Crawler' => 'Jaybizzle\LaravelCrawlerDetect\Facades\LaravelCrawlerDetect',
        ];
    }

    public function setUp()
    {
        parent::setUp();
        $this->LaravelCrawlerDetect = new CrawlerDetect();
    }

    protected function getEnvironmentSetUp($app)
    {
        // reset base path to point to our package's src directory
        $app['path.base'] = __DIR__.'/../src';
    }

    public function testBots()
    {
        $lines = file('https://raw.githubusercontent.com/JayBizzle/Crawler-Detect/master/tests/crawlers.txt');

        foreach ($lines as $line) {
            $test = Crawler::isCrawler($line);
            $this->assertTrue($test, $line);
        }
    }

    public function testDevices()
    {
        $lines = file('https://raw.githubusercontent.com/JayBizzle/Crawler-Detect/master/tests/devices.txt');

        foreach ($lines as $line) {
            $test = Crawler::isCrawler($line);
            $this->assertFalse($test, $line);
        }
    }
}


================================================
FILE: tests/bootstrap.php
================================================
<?php

require_once __DIR__.'/../vendor/autoload.php';

if (class_exists('PHPUnit_Framework_TestCase')) {
    class_alias('PHPUnit_Framework_TestCase', 'PHPUnit\Framework\TestCase');
}
Download .txt
gitextract_9rujszq2/

├── .coveralls.yml
├── .gitignore
├── .styleci.yml
├── .travis.yml
├── LICENSE
├── README.md
├── composer.json
├── phpunit.xml
├── src/
│   ├── Facades/
│   │   └── LaravelCrawlerDetect.php
│   └── LaravelCrawlerDetectServiceProvider.php
└── tests/
    ├── UATests.php
    └── bootstrap.php
Download .txt
SYMBOL INDEX (13 symbols across 3 files)

FILE: src/Facades/LaravelCrawlerDetect.php
  class LaravelCrawlerDetect (line 7) | class LaravelCrawlerDetect extends Facade
    method getFacadeAccessor (line 14) | protected static function getFacadeAccessor()

FILE: src/LaravelCrawlerDetectServiceProvider.php
  class LaravelCrawlerDetectServiceProvider (line 7) | class LaravelCrawlerDetectServiceProvider extends ServiceProvider
    method boot (line 21) | public function boot()
    method register (line 31) | public function register()
    method provides (line 43) | public function provides()

FILE: tests/UATests.php
  class UATests (line 6) | class UATests extends TestCase
    method getPackageProviders (line 10) | protected function getPackageProviders($app)
    method getPackageAliases (line 15) | protected function getPackageAliases($app)
    method setUp (line 22) | public function setUp()
    method getEnvironmentSetUp (line 28) | protected function getEnvironmentSetUp($app)
    method testBots (line 34) | public function testBots()
    method testDevices (line 44) | public function testDevices()
Condensed preview — 12 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (10K chars).
[
  {
    "path": ".coveralls.yml",
    "chars": 24,
    "preview": "service_name: travis-ci\n"
  },
  {
    "path": ".gitignore",
    "chars": 46,
    "preview": "/vendor\ncomposer.phar\ncomposer.lock\n.DS_Store\n"
  },
  {
    "path": ".styleci.yml",
    "chars": 1429,
    "preview": "preset: none\nenabled:\n - array_element_white_space_after_comma\n - blankline_after_open_tag\n - braces\n - concat_without_s"
  },
  {
    "path": ".travis.yml",
    "chars": 370,
    "preview": "language: php\n\nmatrix:\n  include:\n    - php: 5.5\n    - php: 5.6\n    - php: 7.0\n    - php: 7.1\n    - php: 7.2\n    - php: "
  },
  {
    "path": "LICENSE",
    "chars": 1078,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2017 Mark Beech\n\nPermission is hereby granted, free of charge, to any person obtain"
  },
  {
    "path": "README.md",
    "chars": 1915,
    "preview": "Laravel Crawler Detect\n=======\n[![Build Status](https://img.shields.io/travis/JayBizzle/Laravel-Crawler-Detect/master.sv"
  },
  {
    "path": "composer.json",
    "chars": 1174,
    "preview": "{\n    \"name\": \"jaybizzle/laravel-crawler-detect\",\n    \"description\": \"A Laravel package to detect web crawlers via the u"
  },
  {
    "path": "phpunit.xml",
    "chars": 570,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit backupGlobals=\"false\"\n         backupStaticAttributes=\"false\"\n         b"
  },
  {
    "path": "src/Facades/LaravelCrawlerDetect.php",
    "chars": 339,
    "preview": "<?php\n\nnamespace Jaybizzle\\LaravelCrawlerDetect\\Facades;\n\nuse Illuminate\\Support\\Facades\\Facade;\n\nclass LaravelCrawlerDe"
  },
  {
    "path": "src/LaravelCrawlerDetectServiceProvider.php",
    "chars": 918,
    "preview": "<?php\n\nnamespace Jaybizzle\\LaravelCrawlerDetect;\n\nuse Illuminate\\Support\\ServiceProvider;\n\nclass LaravelCrawlerDetectSer"
  },
  {
    "path": "tests/UATests.php",
    "chars": 1374,
    "preview": "<?php\n\nuse Jaybizzle\\CrawlerDetect\\CrawlerDetect;\nuse Orchestra\\Testbench\\TestCase;\n\nclass UATests extends TestCase\n{\n  "
  },
  {
    "path": "tests/bootstrap.php",
    "chars": 185,
    "preview": "<?php\n\nrequire_once __DIR__.'/../vendor/autoload.php';\n\nif (class_exists('PHPUnit_Framework_TestCase')) {\n    class_alia"
  }
]

About this extraction

This page contains the full source code of the JayBizzle/Laravel-Crawler-Detect GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 12 files (9.2 KB), approximately 2.6k tokens, and a symbol index with 13 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!