1. Go to this page and download the library: Download padosoft/laravel-iam-server 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/ */
padosoft / laravel-iam-server example snippets
use Padosoft\Iam\Domain\Authorization\Pdp\NativeSqlEngine;
use Padosoft\Iam\Domain\Authorization\Pdp\DecisionQuery;
use Padosoft\Iam\Contracts\Support\SubjectRef;
$decision = app(NativeSqlEngine::class)->decide(new DecisionQuery(
subject: new SubjectRef('user', '42'),
permission: 'warehouse:stock.adjust',
organizationId: 'org_123',
context: ['amount' => 500], // evaluated by the ABAC condition above
explain: true,
));
$decision->allowed; // bool — deny-overrides, fail-closed
$decision->decisionId; // citable in your audit log
$decision->explanation; // why it decided this way
$decision->