PHP code example of flametrench / laravel

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

    

flametrench / laravel example snippets


return [
    'identity' => ['driver' => env('FLAMETRENCH_IDENTITY_DRIVER', 'in-memory')],
    'tenancy'  => ['driver' => env('FLAMETRENCH_TENANCY_DRIVER',  'in-memory')],
    'authz'    => ['driver' => env('FLAMETRENCH_AUTHZ_DRIVER',    'in-memory')],
];

use Flametrench\Identity\IdentityStore;
use App\Identity\PostgresIdentityStore;

public function register(): void
{
    $this->app->singleton(IdentityStore::class, function ($app) {
        return new PostgresIdentityStore($app->make(\PDO::class));
    });
}

use Flametrench\Tenancy\TenancyStore;

class OrgController
{
    public function __construct(private readonly TenancyStore $tenancy) {}

    public function store(Request $request): JsonResponse
    {
        $result = $this->tenancy->createOrg(
            $request->user()->id,
            name: $request->input('name'),
            slug: $request->input('slug'),
        );
        return response()->json($result['org']);
    }
}

use Flametrench\Laravel\Facades\Flametrench;

$user = Flametrench::identity()->getUser($usrId);
bash
php artisan vendor:publish --tag=flametrench-config