PHPackages                             patrolserver/patrol-laravel - 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. patrolserver/patrol-laravel

ActiveLibrary

patrolserver/patrol-laravel
===========================

A package which implements the PatrolServer SDK

1.1.0(10y ago)0241MITPHPPHP &gt;=5.3.3

Since Oct 22Pushed 10y ago3 watchersCompare

[ Source](https://github.com/PatrolServer/patrol-laravel)[ Packagist](https://packagist.org/packages/patrolserver/patrol-laravel)[ Docs](https://patrolserver.com/)[ RSS](/packages/patrolserver-patrol-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Laravel PatrolServer
====================

[](#laravel-patrolserver)

A Laravel 4/5 package that integrates the [PatrolServer PHP SDK](https://github.com/PatrolServer/patrolsdk-php) in your project.

Requirements
------------

[](#requirements)

PHP 5.3.3 and later.

Laravel 5.x.

Installation
------------

[](#installation)

You can install the package using [Composer](https://getcomposer.org/). You can install it by running this command in your root Laravel folder:

```
composer require patrolserver/laravel-patrol

```

Laravel
-------

[](#laravel)

The package provides a facade for easy integration.

Simply add the `PatrolServer\Patrol\PatrolServiceProvider` provider to the providers array in `config/app.php`.

```
'providers' => [
  ...
  'PatrolServer\Patrol\PatrolServiceProvider',
],
```

And add the `Patrol` alias to access the facade:

```
'aliases' => [
  ...
  'Patrol' => 'PatrolServer\Patrol\Facades\Patrol',
],
```

Config file
-----------

[](#config-file)

You have to enter the API key and secret in the config file. To publish this file:

```
php artisan vendor:publish --provider="PatrolServer\Patrol\PatrolServiceProvider"

```

When the config is succesfully published, a file named `patrol.php` will be available in the config folder of your application, you can then enter your API credentials and various other options in this config file.

Examples
--------

[](#examples)

### SDK

[](#sdk)

You can access your data with the Patrol facade, which is a wrapper function for the SDK object. The available options and more information can be found at the [PatrolServer API Documentation](https://api.patrolserver.com/) page.

```
$user = Patrol::user();

$servers = Patrol::servers();

foreach ($servers as $server)
{
    Log::info($server);
}
```

### Webhook

[](#webhook)

Webhooks are real time events to alert you whenever an event occurs in PatrolServer. For example, your server finished scanning and has new issues. A webhook will be triggered and as a developer, you can now interact based on this new information.

In your `routes.php` file, add the following rule:

```
Route::post('patrolserver/webhook', 'PatrolServerController@webhook');
```

In your controller, you can now define the webhook function. This is a quick example on how to use the SDK:

```
