PHP code example of adsy2010 / laravel-api-credentials

1. Go to this page and download the library: Download adsy2010/laravel-api-credentials 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/ */

    

adsy2010 / laravel-api-credentials example snippets


    'providers' => [
        ...
        /*
         * Application Service Providers...
         */
        \Adsy2010\LaravelApiCredentials\LaravelApiCredentialServiceProvider::class,
        ... 
    ],

$key = 'PUBLIC';
$value = 'TEST_VALUE_STRING';
$service = 'TEST_SERVICE';
$scopes = [];

$credentials = (new Credential)->store($key, $value, $service, $scopes);

$scopes = [
    ['name' => 'Charges', 'access' => ScopeAccess::READ],
    ['name' => 'Payments', 'access' => ScopeAccess::WRITE],
    ['name' => 'Customers', 'access' => ScopeAccess::READ_AND_WRITE],
];

//Load a credential and call delete. This will remove the credential and any scopes attached.
$credential->delete();

$service = 'Quickbooks';
$scopeName = 'Publishable';

(new Scope)->retrieveCredentialValue($service, $scopeName, ScopeAccess::READ_AND_WRITE);
bash
php artisan migrate
bash 
php artisan vendor:publish --provider=Adsy2010\LaravelApiCredentials\LaravelApiCredentialServiceProvider