PHP code example of flipboxfactory / patron
1. Go to this page and download the library: Download flipboxfactory/patron 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/ */
flipboxfactory / patron example snippets
[
'providerHandle' => [
'clientId' => getenv('SOME_PROVIDER_CLIENT_ID'),
'clientSecret' => getenv('SOME_PROVIDER_CLIENT_SECRET'),
],
'anotherProviderHandle' => [
'clientId' => getenv('SOME_OTHER_PROVIDER_CLIENT_ID'),
'clientSecret' => getenv('SOME_OTHER_PROVIDER_CLIENT_SECRET'),
]
]
\yii\base\Event::on(
\flipbox\patron\cp\Cp::class,
\flipbox\patron\events\RegisterProviders::REGISTER_PROVIDERS,
function (\flipbox\patron\events\RegisterProviders $event) {
$event->providers[] = '\your\fully\qualified\provider\class\name'; // Ex: \Stevenmaguire\OAuth2\Client\Provider\Salesforce::class
}
);
\yii\base\Event::on(
'\your\fully\qualified\provider\class\name', // Ex: \Stevenmaguire\OAuth2\Client\Provider\Salesforce::class
\flipbox\patron\events\RegisterProviderSettings::REGISTER_SETTINGS,
function (\flipbox\patron\events\RegisterProviderSettings $event) {
$event->class = '\your\fully\qualified\settings\class\name'; // Ex: \flipbox\patron\salesforce\settings\SalesforceSettings::class
}
);
\yii\base\Event::on(
\flipbox\patron\cp\Cp::class,
\flipbox\patron\events\RegisterProviderInfo::REGISTER_INFO,
function (\flipbox\patron\events\RegisterProviderInfo $event) {
$event->info['\your\fully\qualified\provider\class\name] = [
'name' => 'Your Provider',
'icon' => '/path/to/icon.svg' // Ex: '@vendor/flipboxfactory/patron-salesforce/icons/salesforce.svg'
];
}
);
/** @var \flipbox\patron\records\Provider $provider */
/** @var \craft\base\PluginInterface $yourPlugin */
$provider->saveAndLock($yourPlugin);