PHP code example of artisan-build / built-for-cloud

1. Go to this page and download the library: Download artisan-build/built-for-cloud 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/ */

    

artisan-build / built-for-cloud example snippets


'manifest' => [
    'name' => 'Example Product',
    'slug' => 'example-product',
    'description' => 'The catalog description.',
    'icon' => 'https://scalpels.app/img/products/transparent/example-product.png',
    'product_url' => 'https://scalpels.app/products/example-product',
],
'credentials' => [
    // Keep the other published credential settings.
    'app_purposes' => ['example-product.ingest' => 'consumption'],
],
'ui' => [
    'member_management' => true,
    'personal_credentials' => true,
    'installation_credentials' => true,
    'session_management' => true,
    'managed_transitions' => true,
    'credential_purposes' => ['example-product.ingest'],
],

Invitation::pending()->get();
Invitation::accepted()->get();
Invitation::expired()->delete();

Route::middleware('bfc.auth')->group(function () {
    // signed-in users
});

Route::middleware('bfc.admin')->group(function () {
    // Owner and Admin only
});

use ArtisanBuild\BuiltForCloud\Commands\Concerns\WritesInstallEnv;
use Illuminate\Console\Command;

final class SinkInstallCommand extends Command
{
    use WritesInstallEnv;

    protected $signature = 'sink:install {--api-url=}';

    public function handle(): int
    {
        $apiUrl = $this->option('api-url') ?: text('Sink API URL');

        $envChanged = $this->writeEnvFile($this->laravel->environmentFilePath(), [
            'SINK_API_URL' => $apiUrl,
        ]);

        $this->pinComposerConstraint(base_path('composer.json'), 'artisan-build/sink', 1);

        $this->summarize([
            'env changed' => $envChanged,
            'composer package' => 'artisan-build/sink:^1',
        ]);

        return self::SUCCESS;
    }
}



use ArtisanBuild\BuiltForCloud\Testing\ContractAssertions;
use Illuminate\Foundation\Testing\RefreshDatabase;

uses(RefreshDatabase::class);
uses(ContractAssertions::class);

it('satisfies the Built for Cloud contract', function (): void {
    $this->assertBuiltForCloudContract();
});
bash
php artisan vendor:publish --tag=built-for-cloud-config

php artisan bfc:credential:mint <subject-type> <subject-ref> --local
php artisan bfc:credential:list --local
php artisan bfc:credential:rotate <id> --local
php artisan bfc:credential:activate <id> --fingerprint=<fingerprint> --local
php artisan bfc:credential:revoke <id> --local
bash
php artisan create-admin [email protected] --password=secret --name="Admin"
bash
php artisan create-admin [email protected] --password=secret --name="Ops" --force