PHP code example of protechstudio / oplogger

1. Go to this page and download the library: Download protechstudio/oplogger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

protechstudio / oplogger example snippets


Protechstudio\Oplogger\OploggerProvider::class,

'Oplogger' => Protechstudio\Oplogger\Facades\Oplogger::class,

return [

    'types' => [
        'test' => 'Basic operation for testing purposes.'
    ],

    'repository' => Protechstudio\Oplogger\Repositories\LogRepository::class
];

...
use Protechstudio\Oplogger\Repositories\LogRepositoryContract;

class CustomRepository implements LogRepositoryContract
{
    //your custom repository implementation
}

...
use Protechstudio\Oplogger\Oplogger;

class FooController extends Controller
{
    private $oplogger;
    
    public function __construct(Oplogger $oplogger)
    {
        $this->oplogger = $oplogger;
    }
    
    public function bar()
    {
        $this->oplogger->write('test');
    }
}

...
use Oplogger;

public function bar()
{
    Oplogger::write('test');
}

'types' => [
        'test' => 'Basic operation for testing purposes.',
        'myoperation' => 'Has made %d operations using %s',
    ],

Oplogger::write('myoperation',[4,'parameters']);

// Result will be: 'Has made 4 operations using parameters'

$userid=5;
Oplogger::write('test',[],$userid);
shell
php artisan vendor:publish --provider="Protechstudio\Oplogger\OploggerProvider"
shell
php artisan vendor:publish --provider="Protechstudio\Oplogger\OploggerProvider" --tag="config"
shell
php artisan vendor:publish --provider="Protechstudio\Oplogger\OploggerProvider" --tag="migrations"
shell
php artisan migrate