1. Go to this page and download the library: Download robyajo/pasak 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/ */
robyajo / pasak example snippets
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Internal\Pasak\Concerns\HasSecurityRelations;
class User extends Authenticatable
{
use HasSecurityRelations;
// ...
}
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
// Daftarkan penegakan WAF dan blokir IP secara global
$middleware->append(\Internal\Pasak\Http\Middleware\BlockIpAddress::class);
$middleware->append(\Internal\Pasak\Http\Middleware\DetectSecurityThreats::class);
// Lacak aktivitas sesi pengguna di grup web
$middleware->web(append: [
\Internal\Pasak\Http\Middleware\TrackUserActivity::class,
]);
// Alias middleware keamanan
$middleware->alias([
'pasak.block' => \Internal\Pasak\Http\Middleware\BlockIpAddress::class,
'pasak.detect' => \Internal\Pasak\Http\Middleware\DetectSecurityThreats::class,
'pasak.admin' => \Internal\Pasak\Http\Middleware\EnsureSecurityAdmin::class,
'pasak.activity' => \Internal\Pasak\Http\Middleware\TrackUserActivity::class,
]);
})
->create();