Skip to content

Instantly share code, notes, and snippets.

View md-riaz's full-sized avatar
👨‍💻
PHP Developer

MD Riaz md-riaz

👨‍💻
PHP Developer
View GitHub Profile
@md-riaz
md-riaz / acme_client.php
Last active March 30, 2025 05:57
Supports letsencrypt, buypass, zerossl providers
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
class AcmeClient
{
private $webDir;
private $domain;
private $accountEmail;
<?php
class Attachment
{
private $allowedTypes = [];
private $allowedSize; // Size in MB
private $uploadPath;
private $fileName;
private $files;
private $errors = [];
#!/bin/bash
# Ensure script is run as root
local INST_USER=$(id -u)
if [ $INST_USER != 0 ]; then
echoR "Sorry, only the root user can install."
echo
exit 1
fi
<?php
require 'vendor/autoload.php'; // Include phpseclib
use phpseclib3\Net\SSH2;
class VPSSetup {
private $ssh;
private $domain;
private $email;
private $dbPassword;
@md-riaz
md-riaz / svg-generator-in-js.js
Last active December 24, 2024 04:27
const qr = new QRCode(); const modules = qr.generate("Hello, World!"); console.log(qr.toSVG());
// QR Code Generator Library
class QRCode {
constructor(version = 1, errorCorrection = 'M') {
this.version = version;
this.errorCorrection = errorCorrection;
this.moduleCount = 21 + (version - 1) * 4;
this.modules = Array(this.moduleCount).fill().map(() => Array(this.moduleCount).fill(null));
this.errorCorrectionLevels = {
'L': 0x01, // 7% error correction
'M': 0x00, // 15% error correction
@md-riaz
md-riaz / simpleSipUser.js
Last active November 26, 2024 10:28
sipjs simpleUser class alternative test demo.
class SimpleSipUser {
constructor(options) {
this.options = {
aor: `sip:${options.username}@${options.domain}`,
maxSimultaneousSessions: 5,
media: {
constraints: {
audio: true,
video: false
}
<?php
private static function autoload()
{
spl_autoload_register(function ($class) {
// Define base directories for known namespaces
$baseDirs = [
'Framework\\Core\\' => FRAMEWORK_PATH . 'Core/',
'App\\' => APP_PATH
];
<?php
class JWT {
private $secretKey;
public function __construct($secretKey) {
$this->secretKey = $secretKey;
}
public function generateToken($payload, $expiration = 3600) {
<?php
class WhatsappClass
{
private $phoneNumberId;
private $accessToken;
private $url;
/**
* @param string $phoneNumberId
function getLocalStorage() {
try {
return window.localStorage;
} catch (_) {
const store = {};
return {
getItem(name) {
return store[name] || null;
},
setItem(name, val) {