PHP code example of glesys / butler-service

1. Go to this page and download the library: Download glesys/butler-service 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/ */

    

glesys / butler-service example snippets


use Butler\Service\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    //
}

    // example
    'config' => [
        'foo' => 'bar',
        'trustedproxy.proxies' => [
            '10.0.0.0/8',
        ],
    ],

$consumer = \Butler\Service\Models\Consumer::create(['name' => 'Service A']);

$token = $consumer->createToken(abilities: ['*'], name: 'token-name')->plainTextToken;

// allow "query" operations only
$consumer->createToken(['query'], 'my read-only token');

// allow "mutation" operations only
$consumer->createToken(['mutation'], 'my write-only token');

// allow specific operations
$consumer->createToken(['query:ping'], 'my "ping" token');
$consumer->createToken(['query', 'mutation:start'], 'my "start" token');

// allow any operations
$consumer->createToken(['*'], 'my full-access token');
$consumer->createToken(['query', 'mutation', 'subscription'], 'my graphql token');
shell
php artisan vendor:publish --tag=butler-config --tag=butler-assets
php artisan migrate
shell
php artisan vendor:publish --tag=butler-views
shell
php artisan vendor:publish --force --tag=butler-index