nikolajlovenhardt / laravel-keen-io
Minimal configuration wrapper for Keen.io in Laravel 5.*
Installs: 1 961
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=5.5.0
- keen-io/keen-io: ~2.5.5
- laravel/framework: 5.*
Requires (Dev)
- codeclimate/php-test-reporter: ~0.3.0
- phpmd/phpmd: ~2.4.1
- phpunit/phpunit: ~4.0
- squizlabs/php_codesniffer: ~2.5.1
This package is not auto-updated.
Last update: 2024-10-26 19:10:52 UTC
README
Installation
Install using composer
composer require nikolajlovenhardt/laravel-keen-io
Provider
Add the LaravelKeenIO\LaravelKeenIOProvider
in config/app.php
[ LaravelKeenIO\LaravelKeenIOProvider::class, ],
Then run php artisan vendor:publish
to publishe the keen.io configuration file into config/keen-io.php
and add
your projects.
Facade (optional)
[ 'KeenIO' => LaravelKeenIO\Facades\KeenIOFacade::class, ],
Usage
This package is built as a configuration wrapper for keen-io/keen-io.
Dependency injection (Recommended)
Example:
<?php namespace App\Controllers; use LaravelKeenIO\Services\KeenIOService; use LaravelKeenIO\Services\KeenIOServiceInterface; class DemoController { /** @var KeenIOServiceInterface */ protected $keenIOService; public function __construct(KeenIOService $keenIOService) { $this->keenIOService = $keenIOService; } public function action() { /** @var KeenIOClient $keenIO */ $keenIO = $this->keenIOService->client(); echo 'KeenIOClient with the default project'; } public function anotherAction() { $project = 'projectName'; /** @var KeenIOClient $keenIO */ $keenIO = $this->keenIOService->client($project); echo sprintf( 'KeenIOClient with the \'%s\' project', $project ); } }
Facade
<?php namespace App\Controllers; use KeenIO; use LaravelKeenIO\Services\KeenIOService; use LaravelKeenIO\Services\KeenIOServiceInterface; class DemoController { public function action() { /** @var KeenIOClient $keenIO */ $keenIO = KeenIO::client(); echo 'KeenIOClient with the default project'; } public function anotherAction() { $project = 'projectName'; /** @var KeenIOClient $keenIO */ $keenIO = KeenIO::client($project); echo sprintf( 'KeenIOClient with the \'%s\' project', $project ); } }
Documentation
For more information on the usage of KeenIO
, please refer to the documentation of the PHP client and the
main keen.io documentation.