PHPackages                             snippetify/laravel-sniptbot - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. snippetify/laravel-sniptbot

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

snippetify/laravel-sniptbot
===========================

Sniptbot for laravel

1.0.2(5y ago)14MITPHPPHP ^7.2

Since Jun 30Pushed 5y ago1 watchersCompare

[ Source](https://github.com/snippetify/laravel-sniptbot)[ Packagist](https://packagist.org/packages/snippetify/laravel-sniptbot)[ Docs](https://github.com/snippetify/laravel-sniptbot)[ RSS](/packages/snippetify-laravel-sniptbot/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

Laravel Sniptbot
================

[](#laravel-sniptbot)

This repository implements a simple [ServiceProvider](https://laravel.com/docs/master/providers) that makes the instances of the Snippet **Crawler** and **Sniffer** easily accessible via a [Facade](https://laravel.com/docs/master/facades) in [Laravel](http://laravel.com). See [@Snippetify/Snippet-sniffer](https://github.com/snippetify/snippet-sniffer) for more information about the PHP Snippet sniffing and its interfaces.

What it does
------------

[](#what-it-does)

This library allows you

1. To get code snippets using search engine api (Google)
2. To get code snippets from any web page by crawling url seeds.

How to use it
-------------

[](#how-to-use-it)

```
$ composer require snippetify/laravel-sniptbot
```

```
php artisan vendor:publish --provider="Snippetify\Sniptbot\SniptbotServiceProvider"
```

##### Configuration

[](#configuration)

Open the created file in the `config/sniptbot.php` and customize the configuration options to your liking.

```
return [
    // Search engine api configuration keys
  	'provider' 	=> [
      // Your google Search engine ID
      // https://developers.google.com/custom-search/v1/introduction
    	'cx' 	=> env('SNIPTBOT_PROVIDER_CX', ''),
      // Your google API key
      // https://developers.google.com/custom-search/v1/overview#api_key
    	'key' 	=> env('SNIPTBOT_PROVIDER_KEY', ''),
    	'name' 	=> env('SNIPTBOT_PROVIDER_NAME', 'google'), // provider name (google)
  	],

  	// Optional
  	// Useful for adding meta information to each snippet
  	'app' => [
    	'name' 		=> env('SNIPTBOT_NAME', 'Sniptbot'), // your sniptbot name
    	'version' 	=> env('SNIPTBOT_VERSION', '1.0.0'), // your sniptbot version
  	],

  	// Optional
  	// Useful for logging
  	'logger' => [
    	'name' => env('SNIPTBOT_NAME', 'Sniptbot'), // logger name
    	'file' => storage_path('logs/sniptbot.log'), // logger file path
  	],

  	// Optional
  	// Useful for scraping
  	'html_tags' => [
    	'index' 	=> 'h1, h2, h3, h4, h5, h6, p, li', // Tags to index
    	'snippet' 	=> 'pre[class] code, div[class] code, .highlight pre, code[class]', // Tags to fetch snippets
  	],

  	// Optional
  	// Useful for adding new scrapers
  	// The name must be the website host without the scheme i.e. not https://foo.com but foo.com
  	'scrapers' => [
    	// 'scraper_name' 	 => ScraperClass::class, // You can add as many as you want
  	],

  	// Optional
  	// Useful for adding new providers
  	'providers' => [
    	// 'provider_name' 	=> ProviderClass::class, // You can add as many as you want
  	],

  	// Optional
  	// Useful for web crawling
  	// Please follow the link below for more information as we use Spatie crawler
  	// https://github.com/spatie/crawler
  	'crawler' => [
    	// 'langs' 				 => ['en'],
    	// 'profile' 				 => Snippetify\SnippetSniffer\Profiles\CrawlSubdomainsAndUniqueUri::class,
    	// 'user_agent' 			 => Snippetify\SnippetSniffer\Core::CRAWLER_USER_AGENT,
    	// 'concurrency' 			 => 10,
    	// 'ignore_robots' 		 => false,
    	// 'maximum_depth' 		 => null,
    	// 'execute_javascript' 	 => false,
    	// 'maximum_crawl_count' 	 => null,
    	// 'parseable_mime_types' 	 => ['text/html'],
    	// 'maximum_response_size'  => 1024 * 1024 * 3,
    	// 'delay_between_requests' => 250,
  	]
];
```

#### Sniffing from search engine api

[](#sniffing-from-search-engine-api)

```
use Snippetify\Sniptbot\Facades\Sniffer;

// Important: You must set your search engine keys before using it
// @return Snippetify\SnippetSniffer\Common\Snippet[]
$snippets = Sniffer::fetch('js array contains value');
```

#### Crawl url seeds

[](#crawl-url-seeds)

```
use Snippetify\Sniptbot\Facades\Crawler;

// @return Snippetify\SnippetSniffer\Common\MetaSnippetCollection[]
$snippets = Crawler::fetch(['your urls']);
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](https://github.com/snippetify/laravel-sniptbot/blob/master/CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

You must set the **PROVIDER\_NAME**, **PROVIDER\_CX**, **PROVIDER\_KEY**, **CRAWLER\_URI**, keys in phpunit.xml file before running tests.

**Important:** Those links must contains at least one snippet otherwise the tests will failed.

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/snippetify/laravel-sniptbot/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

1. [Evens Pierre](https://github.com/pierrevensy)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/snippetify/laravel-sniptbot/blob/master/LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

2142d ago

PHP version history (2 changes)1.0.0PHP ^7.3.0

1.0.2PHP ^7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/61660083?v=4)[Snippetify](/maintainers/snippetify)[@snippetify](https://github.com/snippetify)

---

Top Contributors

[![evens-stone](https://avatars.githubusercontent.com/u/11338945?v=4)](https://github.com/evens-stone "evens-stone (4 commits)")

---

Tags

crawlerscrapersniffersnippetssniptbotspidercrawlersnifferspiderscrapercrawlingscrapingsniffingsnippetcode snippetsniptbot

### Embed Badge

![Health badge](/badges/snippetify-laravel-sniptbot/health.svg)

```
[![Health](https://phpackages.com/badges/snippetify-laravel-sniptbot/health.svg)](https://phpackages.com/packages/snippetify-laravel-sniptbot)
```

###  Alternatives

[vdb/php-spider

A configurable and extensible PHP web spider

1.4k181.0k7](/packages/vdb-php-spider)[crwlr/crawler

Web crawling and scraping library.

37214.8k2](/packages/crwlr-crawler)[jaybizzle/laravel-crawler-detect

A Laravel package to detect web crawlers via the user agent

3232.6M17](/packages/jaybizzle-laravel-crawler-detect)[laurentvw/scrapher

A web scraper for PHP to easily extract data from web pages

192.5k1](/packages/laurentvw-scrapher)[crawlbase/crawlbase

A lightweight, dependency free PHP class that acts as wrapper for Crawlbase API

1650.5k](/packages/crawlbase-crawlbase)[crwlr/robots-txt

Robots Exclusion Standard/Protocol Parser for Web Crawling/Scraping

1125.3k1](/packages/crwlr-robots-txt)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
