Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php require 'vendor/autoload.php'; use Firebase\JWT\JWT; use Firebase\JWT\Key; // Define your payload $payload = [ "sub" => "1234567890", "name" => "John Doe", "admin" => true, "iat" => time(), "exp" => time() + 3600 // 1 hour expiration ]; // Define your secret key $secret_key = "your-256-bit-secret"; // Encode the JWT $jwt = JWT::encode($payload, $secret_key, 'HS256'); echo "JWT Token:\n" . $jwt;
Copy Clear