nexylan / graylog-sdk
A PHP sdk to communicate with the Graylog REST API
Installs: 30 200
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 5
Forks: 0
Open Issues: 5
Requires
- php: ^7.0
- php-http/client-common: ^1.4 || ^2.0
- php-http/client-implementation: ^1.0
- php-http/discovery: ^1.0
- php-http/httplug: ^1.1 || ^2.0
- symfony/options-resolver: ^2.8 || ^3.0 || ^4.0
Requires (Dev)
- guzzlehttp/psr7: ^1.3
- php-http/guzzle6-adapter: ^1.1 || ^2.0
- php-http/message: ^1.3
- sllh/php-cs-fixer-styleci-bridge: ^2.1
- symfony/dependency-injection: ^2.8 || ^3.0 || ^4.0
- symfony/http-kernel: ^2.8 || ^3.0 || ^4.0
Suggests
- ext-solr: For Lucene query escaping.
- internations/solr-utils: For Lucene query escaping.
- symfony/dependency-injection: For Symfony integration as a bundle
- symfony/http-kernel: For Symfony integration as a bundle
README
Graylog API PHP SDK.
Documentation
All the installation and usage instructions are located in this README. Check it for a specific versions:
Prerequisites
This version of the project requires:
- PHP 7.0+
Installation
First of all, you need to require this library through Composer:
composer require nexylan/graylog-sdk
Usage
$graylog = new \Nexy\Graylog\Graylog([ 'base_uri' => 'https://your.graylog.instance.com/api' ]); // You may authenticate with API token: $graylog->auth('YourApiToken'); // Or user credentials: $graylog->auth('YourGraylogUsername', 'YourGrayLogPassword'); // Then, start using the API: $result = $graylog->search()->relative()->terms('file', 'source: host.com', 0);
Symfony integration
Activate the bundle:
// config/bundles.php return [ Nexy\Graylog\Bridge\Symfony\Bundle\NexyGraylogBundle::class => ['all' => true], ];
Add the configuration file:
// config/packages/nexy_graylog.yaml nexy_graylog: options: base_uri: ~ # Required auth: # Can be a username or a token. user: ~ # Required # Required only for username auth. password: null
Then, inject the Graylog service thanks to autowiring:
class MyService { private $graylog; public function __construct(Nexy\Graylog\Graylog $graylog) { $this->graylog = $graylog; } }